示例#1
0
 private void verifyOwnership(MemcachedServer server, short vBucketId) {
   if (server != null && server.getBucket().getType() == Bucket.BucketType.MEMCACHED) {
     return;
   }
   if (vBucketId < 0 || vBucketId > vbInfo.length) {
     throw new AccessControlException("Invalid vBucket");
   }
   VBucketInfo vbi = vbInfo[vBucketId];
   if (server != null && vbi.getOwner() != server) {
     throw new AccessControlException("Server is not master for this vb");
   }
 }
示例#2
0
 public void replicateMutatedItem(Item itm) {
   VBucketInfo vbi = vbInfo[itm.getKeySpec().vbId];
   if (vbi.getOwner() != server) {
     return;
   }
   for (MemcachedServer replica : vbi.getReplicas()) {
     Item newItem = new Item(itm);
     VBucketStore rStore = replica.getStorage().cacheStore;
     rStore.getMap().put(newItem.getKeySpec(), newItem);
     rStore.onItemMutated.onAction(rStore, newItem);
   }
 }
示例#3
0
 public void replicateDeletedItem(KeySpec ks) {
   VBucketInfo vbi = vbInfo[ks.vbId];
   if (vbi.getOwner() != server) {
     return;
   }
   Item itm = new Item(ks);
   for (MemcachedServer replica : vbi.getReplicas()) {
     VBucketStore rStore = replica.getStorage().cacheStore;
     rStore.getMap().remove(ks);
     rStore.onItemDelete.onAction(rStore, itm);
     rStore.onItemMutated.onAction(rStore, itm);
   }
 }