コード例 #1
0
ファイル: Program.cs プロジェクト: timothycoleman/FASTER
        static void FixedLenServer(string[] args)
        {
            Console.WriteLine("FASTER fixed-length (binary) KV server");

            ParserResult <Options> result = Parser.Default.ParseArguments <Options>(args);

            if (result.Tag == ParserResultType.NotParsed)
            {
                return;
            }
            var opts = result.MapResult(o => o, xs => new Options());

            opts.GetSettings(out var logSettings, out var checkpointSettings, out var indexSize);

            // We use blittable structs Key and Value to construct a costomized server for fixed-length types
            var store = new FasterKV <Key, Value>(indexSize, logSettings, checkpointSettings);

            if (opts.Recover)
            {
                store.Recover();
            }

            // We specify FixedLenSerializer as our in-built serializer for blittable (fixed length) types
            // This server can be used with compatible clients such as FixedLenClient and FASTER.benchmark
            var server = new FasterKVServer <Key, Value, Input, Output, Functions, FixedLenSerializer <Key, Value, Input, Output> >
                             (store, e => new Functions(), opts.Address, opts.Port);

            server.Start();
            Thread.Sleep(Timeout.Infinite);
        }
コード例 #2
0
        public FixedLenServer(string folderName, Func <Value, Value, Value> merger, string address = "127.0.0.1", int port = 33278)
        {
            this.folderName = folderName;
            GetSettings(folderName, out var logSettings, out var checkpointSettings, out var indexSize);

            // We use blittable structs Key and Value to construct a costomized server for fixed-length types
            store = new FasterKV <Key, Value>(indexSize, logSettings, checkpointSettings);

            // We specify FixedLenSerializer as our in-built serializer for blittable (fixed length) types
            // This server can be used with compatible clients such as FixedLenClient and FASTER.benchmark
            server = new FasterKVServer <Key, Value, Value, Value, FixedLenServerFunctions <Key, Value>, FixedLenSerializer <Key, Value, Value, Value> >
                         (store, e => new FixedLenServerFunctions <Key, Value>(merger), address, port);
            server.Start();
        }
コード例 #3
0
        public VarLenServer(string folderName, string address = "127.0.0.1", int port = 33278)
        {
            this.folderName = folderName;
            GetSettings(folderName, out var logSettings, out var checkpointSettings, out var indexSize);

            // We use blittable structs Key and Value to construct a costomized server for fixed-length types
            store = new FasterKV <SpanByte, SpanByte>(indexSize, logSettings, checkpointSettings);

            // We specify FixedLenSerializer as our in-built serializer for blittable (fixed length) types
            // This server can be used with compatible clients such as FixedLenClient and FASTER.benchmark
            server = server = new FasterKVServer <SpanByte, SpanByte, SpanByte, SpanByteAndMemory, SpanByteFunctionsForServer <long>, SpanByteSerializer>
                                  (store, wp => new SpanByteFunctionsForServer <long>(wp), address, port, new SpanByteSerializer(), default);
            server.Start();
        }