public ContentNodeKitSerializer(ContentDataSerializer contentDataSerializer = null)
 {
     _contentDataSerializer = contentDataSerializer;
     if (_contentDataSerializer == null)
     {
         _contentDataSerializer = DefaultDataSerializer;
     }
 }
Ejemplo n.º 2
0
        public static BPlusTree <int, ContentNodeKit> GetTree(string filepath, bool exists, ContentDataSerializer contentDataSerializer = null)
        {
            var keySerializer   = new PrimitiveSerializer();
            var valueSerializer = new ContentNodeKitSerializer(contentDataSerializer);
            var options         = new BPlusTree <int, ContentNodeKit> .OptionsV2(keySerializer, valueSerializer)
            {
                CreateFile = exists ? CreatePolicy.IfNeeded : CreatePolicy.Always,
                FileName   = filepath,

                // read or write but do *not* keep in memory
                CachePolicy = CachePolicy.None,

                // default is 4096, min 2^9 = 512, max 2^16 = 64K
                FileBlockSize = GetBlockSize(),

                // other options?
            };

            var tree = new BPlusTree <int, ContentNodeKit>(options);

            // anything?
            //btree.

            return(tree);
        }