Пример #1
0
		public static Db4objects.Db4o.Internal.Freespace.AbstractFreespaceManager CreateNew
			(LocalObjectContainer file, byte systemType)
		{
			systemType = CheckType(systemType);
			int unblockedDiscardLimit = file.ConfigImpl.DiscardFreeSpace();
			int blockedDiscardLimit = unblockedDiscardLimit == int.MaxValue ? unblockedDiscardLimit
				 : file.BlockConverter().BytesToBlocks(unblockedDiscardLimit);
			int remainderSizeLimit = file.BlockConverter().BytesToBlocks(RemainderSizeLimit);
			IProcedure4 slotFreedCallback = new _IProcedure4_52(file);
			switch (systemType)
			{
				case FmIx:
				{
					return new FreespaceManagerIx(blockedDiscardLimit, remainderSizeLimit);
				}

				case FmBtree:
				{
					return new BTreeFreespaceManager(file, slotFreedCallback, blockedDiscardLimit, remainderSizeLimit
						);
				}

				default:
				{
					return new InMemoryFreespaceManager(slotFreedCallback, blockedDiscardLimit, remainderSizeLimit
						);
					break;
				}
			}
		}
Пример #2
0
        public static AbstractFreespaceManager CreateNew
            (LocalObjectContainer file, byte systemType)
        {
            systemType = CheckType(systemType);
            var unblockedDiscardLimit = file.ConfigImpl.DiscardFreeSpace();
            var blockedDiscardLimit   = unblockedDiscardLimit == int.MaxValue
                ? unblockedDiscardLimit
                : file.BlockConverter().BytesToBlocks(unblockedDiscardLimit);
            var         remainderSizeLimit = file.BlockConverter().BytesToBlocks(RemainderSizeLimit);
            IProcedure4 slotFreedCallback  = new _IProcedure4_52(file);

            switch (systemType)
            {
            case FmIx:
            {
                return(new FreespaceManagerIx(blockedDiscardLimit, remainderSizeLimit));
            }

            case FmBtree:
            {
                return(new BTreeFreespaceManager(file, slotFreedCallback, blockedDiscardLimit, remainderSizeLimit
                                                 ));
            }

            default:
            {
                return(new InMemoryFreespaceManager(slotFreedCallback, blockedDiscardLimit, remainderSizeLimit
                                                    ));

                break;
            }
            }
        }