code: private String doAdd(String name, String document) throws PolicyIndexException {
          String filename = nameToFile(name).getAbsolutePath();
  
          if (policies.put(name, document.getBytes()) != null) {
              throw new PolicyIndexException("Attempting to add policy " + name + " but it already exists");
          }
  
          try {
              logger.debug("Saving policy file in index: " + filename);
              DataFileUtils.saveDocument(filename, document.getBytes());
          } catch (Exception e) {
              throw new PolicyIndexException("Failed to save policy file " + filename);
          }
  
          return name;
      }
docs: separate add/delete locks for an update