public Task Insert(ShardedVertexInfo shardedVertexInfo)
        {
            TableOperation insertOperation =
                TableOperation.InsertOrReplace((ShardedVertexTable)shardedVertexInfo);

            return(cloudTable.ExecuteAsync(insertOperation));
        }
        public Task Delete(ShardedVertexInfo entry)
        {
            var row = (ShardedVertexTable)entry;

            row.ETag = "*";
            return(cloudTable.ExecuteAsync(TableOperation.Delete(row)));
        }
Example #3
0
 private ShardedVertexInfo UpdateVerion(ShardedVertexInfo svInfo)
 => new ShardedVertexInfo(
     vertexName: svInfo.VertexName,
     epochId: svInfo.EpochId,
     addedShards: svInfo.AddedShards,
     allShards: svInfo.AllShards,
     allInstances: svInfo.AllInstances,
     removedShards: svInfo.RemovedShards,
     shardLocator: svInfo.ShardLocator,
     versionId: FileUtils.GetUpdateVersionId(svInfo.VersionId));
Example #4
0
        private (bool matched, bool versionMatched) MatchVersion(ShardedVertexInfo dbItem, ShardedVertexInfo newItem)
        {
            if (dbItem.VertexName == newItem.VertexName &&
                dbItem.EpochId == newItem.EpochId)
            {
                if (newItem.VersionId == null ||
                    newItem.VersionId == "*" ||
                    newItem.VersionId == dbItem.VersionId)
                {
                    return(true, true);
                }

                return(true, false);
            }

            return(false, false);
        }
Example #5
0
 public async Task RegisterShardedVertexAsync(
     string vertexName,
     List <string> allInstances,
     List <int> allShards,
     List <int> addedShards,
     List <int> removedShards,
     Expression <Func <int, int> > shardLocator)
 {
     await _shardedVertexInfoProvider.Insert(
         ShardedVertexInfo.Create(
             vertexName,
             "0",
             allInstances,
             allShards,
             addedShards,
             removedShards,
             shardLocator));
 }
Example #6
0
 public Task Insert(ShardedVertexInfo shardedVertexInfo)
 => FileUtils.InsertOrUpdate(
     _fileName,
     shardedVertexInfo,
     MatchVersion,
     UpdateVerion);
Example #7
0
 public Task Delete(ShardedVertexInfo entry)
 => FileUtils.DeleteItem(
     _fileName,
     entry,
     MatchVersion);