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))); }
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));
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); }
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)); }
public Task Insert(ShardedVertexInfo shardedVertexInfo) => FileUtils.InsertOrUpdate( _fileName, shardedVertexInfo, MatchVersion, UpdateVerion);
public Task Delete(ShardedVertexInfo entry) => FileUtils.DeleteItem( _fileName, entry, MatchVersion);