public PersistentCollectionSpaceManager(string arrayName, int elementSize, int userHeaderSize)
 {
     AssertElementSize(elementSize);
     _simpleCollectionNextSpace = new PersistentNextSpaceArray(arrayName, elementSize, userHeaderSize + GetFreeSpaceSize());
     PutNextFreeSpaceIndex(FreeSpaceTailIndicator);
     PutUserHeader(new byte[0]);
 }
 public PersistentHashTable(string hashtableName, int tableSize, int keySize, int valueSize, int userHeaderSize)
 {
     _simpleCollectionNextIndex = new PersistentNextSpaceArray(hashtableName, keySize + valueSize, userHeaderSize + GetHeaderSize());
     HashTableHeader header = new HashTableHeader(tableSize, keySize, valueSize);
     _simpleCollectionNextIndex.PutUserHeader(header.Serialize());
     _simpleCollectionNextIndex.Put(tableSize-1, new byte[0]);
 }
 public PersistentCollectionSpaceManager(string arrayName, int elementSize, int userHeaderSize)
 {
     AssertElementSize(elementSize);
     _simpleCollectionNextSpace = new PersistentNextSpaceArray(arrayName, elementSize, userHeaderSize + GetFreeSpaceSize());
     PutNextFreeSpaceIndex(FreeSpaceTailIndicator);
     PutUserHeader(new byte[0]);
 }
        public PersistentHashTable(string hashtableName, int tableSize, int keySize, int valueSize, int userHeaderSize)
        {
            _simpleCollectionNextIndex = new PersistentNextSpaceArray(hashtableName, keySize + valueSize, userHeaderSize + GetHeaderSize());
            HashTableHeader header = new HashTableHeader(tableSize, keySize, valueSize);

            _simpleCollectionNextIndex.PutUserHeader(header.Serialize());
            _simpleCollectionNextIndex.Put(tableSize - 1, new byte[0]);
        }
Ejemplo n.º 5
0
        private void GetNextIndexTestAssert(int expected)
        {
            IPersistentArrayNextSpace target = InitPA("GetPANextIndexTest", 1, 16);

            try{
                target.Put(expected - 1, new byte[0]);
                int actual = target.GetNextIndex();
                Assert.AreEqual(expected, actual);
            }
            finally
            {
                target.Close();
            }
        }
Ejemplo n.º 6
0
        private void GetElementSizeTestAssert(int expected)
        {
            IPersistentArrayNextSpace target = InitPA("GetPAElementSizeTest", expected, 16);

            try
            {
                int actual = target.GetElementSize();
                Assert.AreEqual(expected, actual);
            }
            finally
            {
                target.Close();
            }
        }
Ejemplo n.º 7
0
        private void PutGetTestAssert(int elementIndex, byte[] expected)
        {
            IPersistentArrayNextSpace target = InitPA("PAGetTest", 3, 16);

            try
            {
                target.Put(elementIndex, expected);
                byte[] actual = target.Get(elementIndex);
                TestHelper.AssertByteArraysAreSame(expected, actual);
            }
            finally
            {
                target.Close();
            }
        }
Ejemplo n.º 8
0
        private void GetPutUserHeaderTest(byte[] uHeader)
        {
            IPersistentArrayNextSpace target = InitPA("GetPutPAUserHeaderTest", 1, 16);

            try
            {
                target.PutUserHeader(uHeader);
                byte[] actual = target.GetUserHeader();
                TestHelper.AssertByteArraysAreSame(uHeader, actual);
            }
            finally
            {
                target.Close();
            }
        }
 public PersistentHashTable(string hashtableName)
 {
     _simpleCollectionNextIndex = new PersistentNextSpaceArray(hashtableName);
 }
 public PersistentCollectionSpaceManager(string simpleCollection)
 {
     _simpleCollectionNextSpace = new PersistentNextSpaceArray(simpleCollection);
     AssertElementSize(_simpleCollectionNextSpace.GetElementSize());
 }
 public CachedArray(string arrayName)
 {
     _simpleCollectionNextSpace = new PersistentNextSpaceArray(arrayName);
     InitCache();
 }
 public CachedArray(string arrayName, int elementSize, int userHeaderSize, int cacheSize)
 {
     _simpleCollectionNextSpace = new PersistentNextSpaceArray(arrayName, elementSize, userHeaderSize + GetCacheSizeSize());
     _cache = new LRUElementCache(cacheSize);
     PutUserHeader(new byte[0]);
 }
 public PersistentHashTable(string hashtableName)
 {
     _simpleCollectionNextIndex = new PersistentNextSpaceArray(hashtableName);
 }
 public PersistentCollectionSpaceManager(string simpleCollection)
 {
     _simpleCollectionNextSpace = new PersistentNextSpaceArray(simpleCollection);
     AssertElementSize(_simpleCollectionNextSpace.GetElementSize());
 }
Ejemplo n.º 15
0
 public CachedArray(string arrayName)
 {
     _simpleCollectionNextSpace = new PersistentNextSpaceArray(arrayName);
     InitCache();
 }
Ejemplo n.º 16
0
 public CachedArray(string arrayName, int elementSize, int userHeaderSize, int cacheSize)
 {
     _simpleCollectionNextSpace = new PersistentNextSpaceArray(arrayName, elementSize, userHeaderSize + GetCacheSizeSize());
     _cache = new LRUElementCache(cacheSize);
     PutUserHeader(new byte[0]);
 }