public async Task <FluentResults.Result> Delete(string json) { AssertNotDisposed(); var mut = new Api.Mutation(); mut.DeleteJson = Google.Protobuf.ByteString.CopyFromUtf8(json); return((await Mutate(mut)).ToResult()); }
public async Task <FluentResults.Result <IDictionary <string, string> > > Mutate(string json) { AssertNotDisposed(); var mut = new Api.Mutation(); mut.SetJson = Google.Protobuf.ByteString.CopyFromUtf8(json); return(await Mutate(mut)); }
public FluentResults.Result Delete(string json) { AssertNotDisposed(); var mut = new Api.Mutation(); mut.DeleteJson = Google.Protobuf.ByteString.CopyFromUtf8(json); return(Mutate(mut).ConvertTo()); }
internal FluentResults.Result <IDictionary <string, string> > Mutate(Api.Mutation mutation) { AssertNotDisposed(); if (transactionState != TransactionState.OK) { return(Results.Fail <IDictionary <string, string> >(new TransactionFinished(transactionState.ToString()))); } if (mutation.Del.Count == 0 && mutation.DeleteJson.Length == 0 && mutation.Set.Count == 0 && mutation.SetJson.Length == 0) { return(Results.Ok <IDictionary <string, string> >(new Dictionary <string, string>())); } hasMutated = true; try { mutation.StartTs = context.StartTs; var assigned = client.Mutate(mutation); if (mutation.CommitNow) { transactionState = TransactionState.Committed; } var err = MergeContext(assigned.Context); if (err.IsFailed) { return(err.ConvertToResultWithValueType <IDictionary <string, string> >()); } return(Results.Ok <IDictionary <string, string> >(assigned.Uids)); } catch (RpcException rpcEx) { // From Dgraph code txn.go // // Since a mutation error occurred, the txn should no longer be used // (some mutations could have applied but not others, but we don't know // which ones). Discarding the transaction enforces that the user // cannot use the txn further. Discard(); // Ignore error - user should see the original error. transactionState = TransactionState.Error; // overwrite the aborted value return(Results.Fail <IDictionary <string, string> >(new FluentResults.ExceptionalError(rpcEx))); } }
internal Assigned Mutate(Api.Mutation mut) { AssertNotDisposed(); return(connections.Values.ElementAt(rnd.Next(connections.Count)).Mutate(mut)); }
public async Task <Assigned> Mutate(Api.Mutation mut) { AssertNotDisposed(); return(await connections[GetNextConnection()].Mutate(mut)); }
public async Task <Assigned> Mutate(Api.Mutation mut) { AssertNotDisposed(); return(await connection.MutateAsync(mut)); }
public Assigned Mutate(Api.Mutation mut) { AssertNotDisposed(); return(connection.Mutate(mut)); }
public async Task <FluentResults.Result <IDictionary <string, string> > > ApiMutate(Api.Mutation mutation) { AssertNotDisposed(); return(await Mutate(mutation)); }