This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerable<Tuple<long, NameValueCollection>> GetEdgesFor(string type, long id) | |
{ | |
using(var tx = _env.ReadTransaction()) | |
{ | |
var edgesDataTable = new Table(_emptySchema, "EdgesData", tx); | |
var edgeTypeTree = tx.CreateTree("Edges_"+ type); | |
var fixedSizeTree = edgeTypeTree.FixedTreeFor(from, valSize: 8); | |
using(var it = fixedSizeTree.Iterate()) | |
{ | |
if(it.Seek(Slices.BeforeAllKeys) == false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerable<NameValueCollection> DepthFirstSearch( | |
long start, | |
string edgeType, | |
Func<long, NameValueCollection, bool> nodePredicate, | |
Func<long, NameValueCollection, bool> edgePredicate) | |
{ | |
var seen = new HashSet<long>(); | |
var stack = new Stack<long>(); | |
stack.Push(start); | |
while(stack.Count > 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func readRandomDocs(opts BenchOpts) { | |
if opts.clients > opts.reads { | |
opts.clients = opts.reads | |
} | |
done.Add(opts.clients) // sync.WaitGroup | |
fmt.Printf("%s random doc reads from %s with %s clients\n", | |
humanize.Comma(int64(opts.reads)), | |
baseUrl, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func writeNewDocs(opts BenchOpts) { | |
if opts.clients > opts.reads { | |
opts.clients = opts.reads | |
} | |
done.Add(opts.clients) // sync.WaitGroup | |
data, err := ioutil.ReadFile("data.json") | |
if err != nil { | |
color.Set(color.FgMagenta, color.Bold) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var s1 = store1.OpenSession()) | |
{ | |
s1.Advanced.WaitForReplicationAfterSaveChanges( | |
timeout: TimeSpan.FromSeconds(30), | |
throwOnTimeout: true, | |
replicas: 2, | |
); | |
s1.Store(new User {Name = "Oren"}, "users/1"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var s = store.OpenSession()) | |
{ | |
s.Advanced.WaitForIndexesAfterSaveChanges( | |
timeout: TimeSpan.FromSeconds(30) | |
); | |
s.Store(new User {Name = "Oren"}); | |
s.SaveChanges(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var requestExecuter = _requestExecuters.GetOrAdd(databaseName, | |
new RequestExecuter(Url, databaseName, ApiKey)); | |
var requestExecuter = _requestExecuters.GetOrAdd(databaseName, | |
ignored => new RequestExecuter(Url, databaseName, ApiKey))); | |
var requestExecuter = _requestExecuters.GetOrAdd(databaseName, | |
dbName => new RequestExecuter(Url, dbName, ApiKey))); | |
var requestExecuter = _requestExecuters.GetOrAdd(databaseName, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Xml; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Converters; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using System; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Reflection; | |
using System.Text; | |
using System.Threading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public unsafe class LazyStringParser | |
{ | |
public enum Result | |
{ | |
Failed, | |
DateTime, | |
DateTimeOffset | |
} | |
public static Result TryParseDateTime(byte* buffer, int len, out DateTime dt, out DateTimeOffset dto) |