本文整理汇总了C#中Db4objects.Db4o.Internal.LocalObjectContainer类的典型用法代码示例。如果您正苦于以下问题:C# LocalObjectContainer类的具体用法?C# LocalObjectContainer怎么用?C# LocalObjectContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocalObjectContainer类属于Db4objects.Db4o.Internal命名空间,在下文中一共展示了LocalObjectContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ObjectServerImpl
private ObjectServerImpl(LocalObjectContainer container, ServerConfigurationImpl
serverConfig, int port, bool isEmbeddedServer)
{
_isEmbeddedServer = isEmbeddedServer;
_container = container;
_serverConfig = serverConfig;
_socketFactory = serverConfig.Networking.SocketFactory;
_transactionPool = new ClientTransactionPool(container);
_port = port;
_name = "db4o ServerSocket FILE: " + container.ToString() + " PORT:" + _port;
_container.SetServer(true);
ConfigureObjectServer();
_classInfoHelper = new Db4objects.Db4o.CS.Internal.ClassInfoHelper(Db4oClientServerLegacyConfigurationBridge
.AsLegacy(serverConfig));
_container.ClassCollection().CheckAllClassChanges();
bool ok = false;
try
{
EnsureLoadStaticClass();
StartCommittedCallbackThread(_committedInfosQueue);
StartServer();
if (_serverConfig != null)
{
_serverConfig.ApplyConfigurationItems(this);
}
ok = true;
}
finally
{
if (!ok)
{
Close();
}
}
}
示例2: FreespaceManagerIx
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;
}
}
}
示例3: Open
private void Open()
{
IConfiguration config = ((IConfiguration)_currentConfig.Run());
Db4oLegacyConfigurationBridge.AsIdSystemConfiguration(config).UsePointerBasedSystem
();
_container = (LocalObjectContainer)Db4oFactory.OpenFile(config, TempFile());
}
示例4: WriteFixedPart
public override void WriteFixedPart(LocalObjectContainer file, bool startFileLockingThread
, bool shuttingDown, StatefulBuffer writer, int blockSize)
{
SystemData systemData = file.SystemData();
writer.Append(Signature);
writer.WriteByte(Version());
writer.WriteInt((int)TimeToWrite(_timerFileLock.OpenTime(), shuttingDown));
writer.WriteLong(TimeToWrite(_timerFileLock.OpenTime(), shuttingDown));
writer.WriteLong(TimeToWrite(Runtime.CurrentTimeMillis(), shuttingDown));
writer.WriteInt(blockSize);
writer.WriteInt(systemData.ClassCollectionID());
writer.WriteByte(systemData.IdSystemType());
writer.WriteInt(((FileHeaderVariablePart2)_variablePart).Address());
writer.WriteInt(((FileHeaderVariablePart2)_variablePart).Length());
writer.WriteInt(_transactionPointerAddress);
writer.Write();
if (shuttingDown)
{
WriteVariablePart(file, true);
}
else
{
file.SyncFiles();
}
if (startFileLockingThread)
{
file.ThreadPool().Start("db4o lock thread", _timerFileLock);
}
}
示例5: AssertSingleEntry
public virtual void AssertSingleEntry(LocalObjectContainer container, long id)
{
var called = new BooleanByRef();
Index(container).TraverseKeys(container.SystemTransaction(), new _IVisitor4_24(id
, called));
Assert.IsTrue(called.value);
}
示例6: BTreeFreespaceManager
public BTreeFreespaceManager(LocalObjectContainer file, IProcedure4 slotFreedCallback
, int discardLimit) : base(slotFreedCallback, discardLimit)
{
_file = file;
_delegate = new InMemoryFreespaceManager(slotFreedCallback, discardLimit);
_idSystem = file.SystemData().FreespaceIdSystem();
}
示例7: InitNew
/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
public sealed override void InitNew(LocalObjectContainer file)
{
NewTimerFileLock(file);
OldEncryptionOff(file);
_variablePart = CreateVariablePart(file);
WriteVariablePart(file);
}
示例8: CollectFor
public virtual long CollectFor(LocalObjectContainer db, int id, ISlotMap slotMap)
{
var bigSet = db.GetByID(id);
db.Activate(bigSet, 1);
var btree = (BTree) Reflection4.GetFieldValue(bigSet, "_bTree");
return FileUsageStatsCollector.BTreeUsage(db, btree, slotMap);
}
示例9: DefragmentServicesImpl
/// <exception cref="System.IO.IOException"></exception>
public DefragmentServicesImpl(DefragmentConfig defragConfig, IDefragmentListener
listener)
{
_listener = listener;
var originalConfig = (Config4Impl) defragConfig.Db4oConfig();
var storage = defragConfig.BackupStorage();
if (defragConfig.ReadOnly())
{
storage = new NonFlushingStorage(storage);
}
var sourceConfig = PrepareConfig(originalConfig, storage, defragConfig.ReadOnly
());
_sourceDb = (LocalObjectContainer) Db4oFactory.OpenFile(sourceConfig, defragConfig
.TempPath()).Ext();
_sourceDb.ShowInternalClasses(true);
defragConfig.Db4oConfig().BlockSize(_sourceDb.BlockSize());
if (!originalConfig.GenerateCommitTimestamps().DefiniteNo())
{
defragConfig.Db4oConfig().GenerateCommitTimestamps(_sourceDb.Config().GenerateCommitTimestamps
().DefiniteYes());
}
_targetDb = FreshTargetFile(defragConfig);
_mapping = defragConfig.Mapping();
_mapping.Open();
_defragConfig = defragConfig;
}
示例10: LocalTransaction
public LocalTransaction(ObjectContainerBase container, Transaction parentTransaction
, ITransactionalIdSystem idSystem, IReferenceSystem referenceSystem) : base(container
, parentTransaction, referenceSystem)
{
_file = (LocalObjectContainer) container;
_committedCallbackDispatcher = new _ICommittedCallbackDispatcher_39(this);
_idSystem = idSystem;
}
示例11: Store
private void Store(LocalObjectContainer origDb)
{
for (int itemId = 0; itemId < NumItems; itemId++)
{
origDb.Store(new MemoryBackupTestCaseBase.Item(itemId));
}
origDb.Commit();
}
示例12: NewOnSignatureMatch
protected override FileHeader NewOnSignatureMatch(LocalObjectContainer file, ByteArrayBuffer
reader)
{
if (SignatureMatches(reader, Signature, Version()))
{
return CreateNew();
}
return null;
}
示例13: NewInstance
public static IIdSystem NewInstance(LocalObjectContainer localContainer)
{
SystemData systemData = localContainer.SystemData();
byte idSystemType = systemData.IdSystemType();
switch (idSystemType)
{
case Legacy:
{
return new PointerBasedIdSystem(localContainer);
}
case PointerBased:
{
return new PointerBasedIdSystem(localContainer);
}
case StackedBtree:
{
InMemoryIdSystem inMemoryIdSystem = new InMemoryIdSystem(localContainer);
BTreeIdSystem bTreeIdSystem = new BTreeIdSystem(localContainer, inMemoryIdSystem);
systemData.FreespaceIdSystem(bTreeIdSystem.FreespaceIdSystem());
return new BTreeIdSystem(localContainer, bTreeIdSystem);
}
case SingleBtree:
{
InMemoryIdSystem smallInMemoryIdSystem = new InMemoryIdSystem(localContainer);
BTreeIdSystem smallBTreeIdSystem = new BTreeIdSystem(localContainer, smallInMemoryIdSystem
);
systemData.FreespaceIdSystem(smallBTreeIdSystem.FreespaceIdSystem());
return smallBTreeIdSystem;
}
case InMemory:
{
return new InMemoryIdSystem(localContainer);
}
case Custom:
{
IIdSystemFactory customIdSystemFactory = localContainer.ConfigImpl.CustomIdSystemFactory
();
if (customIdSystemFactory == null)
{
throw new Db4oFatalException("Custom IdSystem configured but no factory was found. See IdSystemConfiguration#useCustomSystem()"
);
}
return customIdSystemFactory.NewInstance(localContainer);
}
default:
{
return new PointerBasedIdSystem(localContainer);
break;
}
}
}
示例14: RebuildIndexForClass
public virtual bool RebuildIndexForClass(LocalObjectContainer container, ClassMetadata
classMetadata)
{
long[] ids = classMetadata.GetIDs();
for (int i = 0; i < ids.Length; i++)
{
RebuildIndexForObject(container, (int)ids[i]);
}
return ids.Length > 0;
}
示例15: RebuildIndexForObject
/// <exception cref="Db4objects.Db4o.Internal.FieldIndexException"></exception>
protected virtual void RebuildIndexForObject(LocalObjectContainer container, int
objectId)
{
StatefulBuffer writer = container.ReadStatefulBufferById(container.SystemTransaction
(), objectId);
if (writer != null)
{
RebuildIndexForWriter(container, writer, objectId);
}
}