public ContentNodeKitSerializer(ContentDataSerializer contentDataSerializer = null)
 {
     _contentDataSerializer = contentDataSerializer;
     if (_contentDataSerializer == null)
     {
         _contentDataSerializer = s_defaultDataSerializer;
     }
 }
Exemple #2
0
        public static BPlusTree <int, ContentNodeKit> GetTree(string filepath, bool exists, NuCacheSettings settings, 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(settings),

                //HACK: Forces FileOptions to be WriteThrough here: https://github.com/mamift/CSharpTest.Net.Collections/blob/9f93733b3af7ee0e2de353e822ff54d908209b0b/src/CSharpTest.Net.Collections/IO/TransactedCompoundFile.cs#L316-L327,
                // as the reflection uses otherwise will failed in .NET Core as the "_handle" field in FileStream is renamed to "_fileHandle".
                StoragePerformance = StoragePerformance.CommitToDisk,



                // other options?
            };

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

            // anything?
            //btree.

            return(tree);
        }