public static IEnumerable <Node> BuildLotsNodes() { var now = DateTime.Now.Ticks; var seededRandom = new Random(1337); KeyValue fn() { return(Utils.PropString("FirstName", "Austin", now)); } KeyValue ln() { return(Utils.PropString("LastName", "Harris", now)); } KeyValue follo(string id) { return(Utils.PropData("follows", Utils.DataId(new NodeID { Iri = id }), now)); } KeyValue[] pregenStuff(string id) { return(new[] { fn(), ln(), follo(id), follo(id), follo(id) }); } Node mkNode(string id) { var nid = new NodeID { Iri = id, }; var attrs = pregenStuff(id); var m = new Map { Items = attrs }; return(new Node { Id = nid, Attributes = m }); } for (int i = 0; i < 200000; i++) { yield return(mkNode(i.ToString())); } }
public async ValueTask <OperationStatus> ExceptNode(Node node) { CheckDisposed(); var id = node.Id; var attrs = node.Attributes; // because we are going to except any attributes passed in, it's ok to smash over the keyMeta to pass that behavior in foreach (var prop in attrs.Items) { prop.KeyMeta = Utils.DataId(new NodeID { Iri = Utils.Const.RmwExcept }); } var bytes = attrs.ToSizePrefixedBytes(); var task = await _session.RMWAsync(ref id, ref bytes, Empty.Default, Interlocked.Increment(ref _serial)); while (task.Status == Status.PENDING) { task = await task.CompleteAsync(); } return((OperationStatus)task.Status); }