Created
March 8, 2022 17:54
-
-
Save itn3000/5e9ab7ae0b3348177a54a2b053760e3c to your computer and use it in GitHub Desktop.
FasterLog v2pre sandbox
This file contains hidden or 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 FASTER.core; | |
| using var x = Devices.CreateLogDevice("xlog"); | |
| var flsetting = new FasterLogSettings("hoge"); | |
| using var fl = new FasterLog(new FasterLogSettings("hoge") | |
| // { | |
| // FastCommitMode = true, | |
| // LogCommitDir = "xlog-commits" | |
| // } | |
| ); | |
| var data = new byte[256]; | |
| for (int i = 0; i < 100; i++) | |
| { | |
| fl.Enqueue(data); | |
| } | |
| fl.CommitStrongly(out var tail, out var commitNum); | |
| Console.WriteLine($"{tail},{commitNum}"); | |
| fl.CommitStrongly(out tail, out commitNum); | |
| fl.Commit(true); | |
| fl.Commit(true); | |
| using var iter = fl.Scan(fl.BeginAddress, fl.TailAddress); | |
| long totalNum = 0; | |
| long totalBytes = 0; | |
| await foreach(var item in iter.GetAsyncEnumerable()) | |
| { | |
| totalNum++; | |
| totalBytes += item.entryLength; | |
| } | |
| Console.WriteLine($"{totalNum}, {totalBytes}"); | |
| class Hoge : ILogEnqueueEntry | |
| { | |
| public int SerializedLength => throw new NotImplementedException(); | |
| public void SerializeTo(Span<byte> dest) | |
| { | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment