|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
using FASTER.core;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
@ -28,9 +29,16 @@ namespace ZeroLevel.Services.Microservices.Dump
|
|
|
|
|
public void Dump(T value)
|
|
|
|
|
{
|
|
|
|
|
var packet = MessageSerializer.SerializeCompatible(value);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
while (!log.TryEnqueue(packet, out _)) ;
|
|
|
|
|
log.Commit();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task DumpAsync(T value)
|
|
|
|
|
{
|
|
|
|
@ -41,7 +49,7 @@ namespace ZeroLevel.Services.Microservices.Dump
|
|
|
|
|
public IEnumerable<T> ReadAndTruncate()
|
|
|
|
|
{
|
|
|
|
|
byte[] result;
|
|
|
|
|
using (var iter = log.Scan(log.BeginAddress, log.TailAddress))
|
|
|
|
|
using (var iter = log.Scan(log.BeginAddress, long.MaxValue))
|
|
|
|
|
{
|
|
|
|
|
while (iter.GetNext(out result, out int length))
|
|
|
|
|
{
|
|
|
|
|