Adds a space.

@param spaceID
@param storeID
540675
public void addSpace(String spaceID, Map<String, AclType> userACLs, String storeID)
        throws ResourceException, InvalidIdException {
        IdUtil.validateSpaceId(spaceID);

        try {
            StorageProvider storage = storageProviderFactory.getStorageProvider(storeID);
            storage.createSpace(spaceID);

            waitForSpaceCreation(storage, spaceID);
            updateSpaceACLs(spaceID, userACLs, storeID);
        } catch (NotFoundException e) {
            throw new InvalidIdException(e.getMessage());
        } catch (Exception e) {
            storageProviderFactory.expireStorageProvider(storeID);
            throw new ResourceException("add space", spaceID, e);
        }
    }
913380
private void deleteDestSpace(final String spaceId)
        throws TaskExecutionFailedException {
        log.info("Deleting space " + spaceId +
                 " from dest provider in account " + dupTask.getAccount());
        try {
            new Retrier().execute(new Retriable() {
                @Override
                public String retry() throws Exception {
                    // The actual method being executed
                    destStore.deleteSpace(spaceId);
                    return "success";
                }
            });
        } catch (Exception e) {
            String msg = "Error attempting to delete the destination space: " +
                         e.getMessage();
            throw new DuplicationTaskExecutionFailedException(
                buildFailureMessage(msg), e);
        }
        log.info("Successfully deleted space " + spaceId +
                 " from dest provider in account " + dupTask.getAccount());
    }
1131842
@PUT
    public Response putContent(@PathParam("spaceID") String spaceID,
                               @PathParam("contentID") String contentID,
                               @QueryParam("storeID") String storeID,
                               @HeaderParam(COPY_SOURCE_HEADER) String copySource,
                               @HeaderParam(COPY_SOURCE_STORE_HEADER) String sourceStoreID) {
        if (null != copySource) {
            return copyContent(spaceID, contentID, storeID, sourceStoreID, copySource);

        } else {
            return addContent(spaceID, contentID, storeID);
        }
    }
493064
private boolean add(DBIDRef cur, DBIDRef cand, double distance) {
    KNNHeap neighbors = store.get(cur);
    if(neighbors.contains(cand)) {
      return false;
    }
    double newKDistance = neighbors.insert(distance, cand);
    return (distance <= newKDistance);
  }
1251009
def add_space(address, size)
      node = self

      loop do
        if node.size == 0
          # This happens only for the root node if the tree is empty.
          node.set_size_and_address(size, address)
          break
        elsif size < node.size
          # The new size is smaller than this node.
          if node.smaller
            # There is already a smaller node, so pass it on.
            node = node.smaller
          else
            # There is no smaller node yet, so we create a new one as a
            # smaller child of the current node.
            node.set_link('@smaller',
                          SpaceTreeNode::create(@tree, address, size, node))
            break
          end
        elsif size > node.size
          # The new size is larger than this node.
          if node.larger
            # There is already a larger node, so pass it on.
            node = node.larger
          else
            # There is no larger node yet, so we create a new one as a larger
            # child of the current node.
            node.set_link('@larger',
                          SpaceTreeNode::create(@tree, address, size, node))
            break
          end
        else
          # Same size as current node. Insert new node as equal child at top of
          # equal list.
          new_node = SpaceTreeNode::create(@tree, address, size, node)
          new_node.set_link('@equal', node.equal)

          node.set_link('@equal', new_node)

          break
        end
      end
    end
1257002
public CMASpace fetchOne(String spaceId) {
    assertNotNull(spaceId, "spaceId");
    return service.fetchOne(spaceId).blockingFirst();
  }
668043
public void deleteDataStore(final int id) {
        invoke(DATA_STORES, id,
                new RequestClosure<JsonStructure>() {
                    @Override
                    public JsonStructure call(Invocation.Builder request) {
                        Response response = request.delete();
                        if (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {
                            throw new ResponseParseException(DATA_STORES, id, null, null);
                        }
                        return null;
                    }
                },
                null
        );
    }
122309
@Path("/{spaceID}")
    @DELETE
    public Response deleteSpace(@PathParam("spaceID") String spaceID,
                                @QueryParam("storeID") String storeID) {
        String msg = "deleting space(" + spaceID + ", " + storeID + ")";

        try {
            log.debug(msg);
            return doDeleteSpace(spaceID, storeID);

        } catch (ResourceNotFoundException e) {
            return responseNotFound(msg, e, NOT_FOUND);

        } catch (ResourceException e) {
            return responseBad(msg, e, INTERNAL_SERVER_ERROR);

        } catch (Exception e) {
            return responseBad(msg, e, INTERNAL_SERVER_ERROR);
        }
    }
89775
@Override
    @Transactional(MillJpaRepoConfig.TRANSACTION_MANAGER_BEAN)
    public void delete(String account, String storeId, String spaceId) {
        int deleted = 0;
        while ((deleted = bitLogItemRepo.deleteFirst50000ByAccountAndStoreIdAndSpaceId(account,
                                                                                       storeId,
                                                                                       spaceId)) > 0) {
            log.info("deleted {} bit log items where account = {}, store_id = {}, space_id = {}",
                     deleted,
                     account,
                     storeId,
                     spaceId);

            this.bitLogItemRepo.flush();
        }
    }
783648
protected void invalidateCacheEntry(String spaceId, String key, Object data) {
        if (isCacheEnabled()) {
            putToCache(getCacheName(), calcCacheKey(spaceId, key), data);
        }
    }
1068658
@Override
    public void setID(String id) {
        _ID = id;
        if (_store != null) {
            _store.setID(id);
        }
    }
14287
long storeSpaceForAdd() {
        return ConcurrentSubList.maximumSerializedSize() // List header
               + 3 * ConcurrentSubList.Link.maximumSerializedSize() // Current,Previous,Next links  
               + 4 * owningToken.objectStore.getAddSpaceOverhead() // Store overhead for all of the above.
               + storeSpaceForRemove(); // In case we backoutTheAdd.
    }
586394
@HEAD
    public Response getContentProperties(@PathParam("spaceID") String spaceID,
                                         @PathParam("contentID") String contentID,
                                         @QueryParam("storeID") String storeID) {
        StringBuilder msg = new StringBuilder("getting content properties(");
        msg.append(spaceID);
        msg.append(", ");
        msg.append(contentID);
        msg.append(", ");
        msg.append(storeID);
        msg.append(")");

        try {
            Map<String, String> properties =
                contentResource.getContentProperties(spaceID, contentID, storeID);

            log.debug(msg.toString());
            return addContentPropertiesToResponse(Response.ok(), properties);

        } catch (ResourceNotFoundException e) {
            return responseNotFound(msg.toString(), e, NOT_FOUND);

        } catch (ResourceException e) {
            return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);

        } catch (Exception e) {
            return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);
        }
    }
1220202
def _appendstore(self, store):
        """"""
        if not store.bitlength:
            return
        # Set new array offset to the number of bits in the final byte of current array.
        store = offsetcopy(store, (self.offset + self.bitlength) % 8)
        if store.offset:
            # first do the byte with the join.
            joinval = (self._rawarray.pop() & (255 ^ (255 >> store.offset)) |
                       (store.getbyte(0) & (255 >> store.offset)))
            self._rawarray.append(joinval)
            self._rawarray.extend(store._rawarray[1:])
        else:
            self._rawarray.extend(store._rawarray)
        self.bitlength += store.bitlength
1068744
private Response addSpaceACLsToResponse(ResponseBuilder response,
                                            String spaceID,
                                            String storeID)
        throws ResourceException {
        Map<String, String> aclProps = new HashMap<String, String>();
        Map<String, AclType> acls = spaceResource.getSpaceACLs(spaceID,
                                                               storeID);
        for (String key : acls.keySet()) {
            aclProps.put(key, acls.get(key).name());
        }
        return addPropertiesToResponse(response, aclProps);
    }
1324936
public void deleteSpaceSync(String spaceId) {
        log.debug("deleteSpaceSync(" + spaceId + ")");
        throwIfSpaceNotExist(spaceId);

        Map<String, String> allProps = getAllSpaceProperties(spaceId);
        allProps.put("is-delete", "true");
        doSetSpaceProperties(spaceId, allProps);

        SpaceDeleteWorker deleteWorker = getSpaceDeleteWorker(spaceId);
        deleteWorker.run();
    }
550625
protected void countSpaces(String host,
                               DuplicationInfo info,
                               ContentStore store,
                               List<String> spaces,
                               boolean primary) {
        String storeId = store.getStoreId();
        String storeType = store.getStorageProviderType();
        for (String spaceId : spaces) {
            boolean doCount = false;
            // Handle spaces which include space ID, formatted like: spaceId:storeId
            if (spaceId.indexOf(":") > -1) {
                String[] spaceAndStoreId = spaceId.split(":");
                spaceId = spaceAndStoreId[0];
                if (primary || storeId.equals(spaceAndStoreId[1])) {
                    doCount = true;
                }
            } else {
                doCount = true;
            }

            if (doCount) {
                countSpace(host, spaceId, storeId, storeType, info, store);
            }
        }
    }