Esempio n. 1
0
        protected internal virtual int SaveBlocks(ICollectionOnDisk parent, int maxBlocks, bool clear)
        {
            int r = 0;

            if (parent != null)
            {
                if (!_inSaveBlocks && !DelaySaveBlocks)
                {
                    _inSaveBlocks = true;
                    r             = Blocks.Count;
                    if (Blocks.Count >= maxBlocks)
                    {
                        WriteBlocksToDisk(parent, Blocks, clear);
                        if (DataBlockDriver.BlockRecycler == null)
                        {
                            ((DataBlockDriver)DataBlockDriver).BlockRecycler =
                                new DataBlockRecycler(File.Profile.MaxInMemoryBlockCount);
                            ((DataBlockRecycler)((DataBlockDriver)DataBlockDriver).BlockRecycler).PreAllocateBlocks(DataBlockSize);
                        }
                        DataBlockDriver.BlockRecycler.Recycle(Blocks.Values);
                        Blocks.Clear();
                    }
                    _inSaveBlocks = false;
                }
            }
            return(r);
        }
Esempio n. 2
0
        internal static RecordKey CreateKey(ICollectionOnDisk collection, long address)
        {
            var key = new RecordKey();

            key.ServerSystemFilename = collection.File.Server.Filename;
            key.Filename             = collection.File.Filename;
            key.CollectionName       = collection.Name;
            key.Address = address;
            return(key);
        }
Esempio n. 3
0
 private bool SystemManagedStore(ICollectionOnDisk store)
 {
     return(store == ((FileSet)Server.FileSet).Btree ||
            store == _store ||
            store == ((FileRecycler)DeletedCollections).Collection);
 }
Esempio n. 4
0
 internal static RecordKey CreateKey(ICollectionOnDisk collection)
 {
     return(CreateKey(collection, -1));
 }
Esempio n. 5
0
 protected virtual void WriteBlocksToDisk(ICollectionOnDisk parent,
                                          IDictionary <long, Sop.DataBlock> blocks, bool clear)
 {
     DataBlockDriver.WriteBlocksToDisk(parent, blocks, clear);
 }
Esempio n. 6
0
 protected int SaveBlocks(ICollectionOnDisk parent, bool clear)
 {
     return(SaveBlocks(parent, 1, clear));
 }