Examples of ArrayStore


Examples of krati.store.ArrayStore

        SegmentFactory segmentFactory = new MappedSegmentFactory();
       
        /**
         * StaticArrayStore does not change length after the store has been created.
         */
        ArrayStore store = StoreFactory.createStaticArrayStore(
                homeDir,
                length,
                segmentFileSizeMB,
                segmentFactory);
       
        assertEquals(length, store.length());
        assertEquals(length, store.capacity());
        assertEquals(0, store.getIndexStart());
        store.clear();
        store.close();
       
        // Smaller length has no impact
        int smallerLength = length - 500;
        store = StoreFactory.createStaticArrayStore(
                homeDir,
                smallerLength,
                batchSize,
                numSyncBatches,
                segmentFileSizeMB,
                segmentFactory);
       
        assertEquals(length, store.length());
        assertEquals(length, store.capacity());
        assertEquals(0, store.getIndexStart());
        store.clear();
        store.close();
       
        // Larger length has no impact
        int largerLength = length + 500;
        store = StoreFactory.createStaticArrayStore(
                homeDir,
                largerLength,
                batchSize,
                numSyncBatches,
                segmentFileSizeMB,
                segmentFactory,
                segmentCompactFactor);
       
        assertEquals(length, store.length());
        assertEquals(length, store.capacity());
        assertEquals(0, store.getIndexStart());
        store.clear();
        store.close();
       
        // Use StoreConfig
        StoreConfig config = new StoreConfig(homeDir, length);
        config.setBatchSize(batchSize);
        config.setNumSyncBatches(numSyncBatches);
        config.setSegmentFileSizeMB(segmentFileSizeMB);
        config.setSegmentFactory(segmentFactory);
        config.setSegmentCompactFactor(segmentCompactFactor);
        store = StoreFactory.createStaticArrayStore(config);
       
        assertEquals(length, store.length());
        assertEquals(length, store.capacity());
        assertEquals(0, store.getIndexStart());
        store.clear();
        store.close();
       
        FileUtils.deleteDirectory(homeDir);
    }
View Full Code Here

Examples of krati.store.ArrayStore

        SegmentFactory segmentFactory = new MappedSegmentFactory();
       
        /**
         * DynamicArrayStore only grows its capacity/length after the store has been created.
         */
        ArrayStore store = StoreFactory.createDynamicArrayStore(
                homeDir,
                initialLength,
                segmentFileSizeMB,
                segmentFactory);
       
        assertEquals(initialLength, store.length());
        assertEquals(initialLength, store.capacity());
        assertEquals(0, store.getIndexStart());
        store.clear();
        store.close();
       
        // Smaller length has no impact
        int smallerLength = initialLength - 500;
        store = StoreFactory.createDynamicArrayStore(
                homeDir,
                smallerLength,
                batchSize,
                numSyncBatches,
                segmentFileSizeMB,
                segmentFactory);
       
        assertEquals(initialLength, store.length());
        assertEquals(initialLength, store.capacity());
        assertEquals(0, store.getIndexStart());
        store.clear();
        store.close();
       
        // Larger length caused the store to grow capacity
        int largerLength = initialLength + 500;
        int expectedLength = initialLength + DynamicConstants.SUB_ARRAY_SIZE;
        store = StoreFactory.createDynamicArrayStore(
                homeDir,
                largerLength,
                batchSize,
                numSyncBatches,
                segmentFileSizeMB,
                segmentFactory,
                segmentCompactFactor);
       
        assertEquals(expectedLength, store.length());
        assertEquals(expectedLength, store.capacity());
        assertEquals(0, store.getIndexStart());
        store.clear();
        store.close();
       
        // Use StoreConfig
        StoreConfig config = new StoreConfig(homeDir, initialLength);
        config.setBatchSize(batchSize);
        config.setNumSyncBatches(numSyncBatches);
        config.setSegmentFileSizeMB(segmentFileSizeMB);
        config.setSegmentFactory(segmentFactory);
        config.setSegmentCompactFactor(segmentCompactFactor);
        store = StoreFactory.createDynamicArrayStore(config);
       
        assertEquals(expectedLength, store.length());
        assertEquals(expectedLength, store.capacity());
        assertEquals(0, store.getIndexStart());
        store.clear();
        store.close();
       
        FileUtils.deleteDirectory(homeDir);
    }
View Full Code Here

Examples of krati.store.ArrayStore

        this._storeFactory = storeFactory;
    }
   
    @Override
    public BasicArrayStoreResponder createResponder(StoreConfig config) throws Exception {
        ArrayStore store = _storeFactory.create(config);
        return new BasicArrayStoreResponder(store);
    }
View Full Code Here

Examples of org.datanucleus.store.scostore.ArrayStore

            NucleusLogger.PERSISTENCE.debug(LOCALISER.msg("007009", mmd.getFullFieldName()));
        }

        // Update the datastore
        // TODO Do this more efficiently, removing elements no longer present, and adding new ones
        ArrayStore backingStore = (ArrayStore) storeMgr.getBackingStoreForField(ownerOP.getExecutionContext().getClassLoaderResolver(), mmd, null);
        backingStore.clear(ownerOP);
        backingStore.set(ownerOP, value);
    }
View Full Code Here

Examples of org.datanucleus.store.scostore.ArrayStore

        {
            return;
        }

        // Clear the array via its backing store
        ArrayStore backingStore = (ArrayStore) storeMgr.getBackingStoreForField(sm.getExecutionContext().getClassLoaderResolver(), mmd, null);
        backingStore.clear(sm);
    }
View Full Code Here

Examples of org.datanucleus.store.scostore.ArrayStore

     * @param clr ClassLoader resolver
     * @return The backing store of this array in this store
     */
    private ArrayStore getBackingStoreForArray(AbstractMemberMetaData mmd, ClassLoaderResolver clr)
    {
        ArrayStore store;
        DatastoreContainerObject datastoreTable = getDatastoreContainerObject(mmd);
        if (datastoreTable != null)
        {
            store = newJoinArrayStore(mmd, clr, datastoreTable);
        }
View Full Code Here

Examples of org.datanucleus.store.scostore.ArrayStore

            NucleusLogger.PERSISTENCE.debug(LOCALISER.msg("007009", mmd.getFullFieldName()));
        }

        // Update the datastore
        // TODO Do this more efficiently, removing elements no longer present, and adding new ones
        ArrayStore backingStore = (ArrayStore) storeMgr.getBackingStoreForField(ec.getClassLoaderResolver(), mmd, null);
        backingStore.clear(ownerOP);
        backingStore.set(ownerOP, value);
    }
View Full Code Here

Examples of org.datanucleus.store.scostore.ArrayStore

        {
            return;
        }

        // Clear the array via its backing store
        ArrayStore backingStore = (ArrayStore) storeMgr.getBackingStoreForField(sm.getExecutionContext().getClassLoaderResolver(), mmd, null);
        backingStore.clear(sm);
    }
View Full Code Here

Examples of org.datanucleus.store.scostore.ArrayStore

     * @param clr ClassLoader resolver
     * @return The backing store of this array in this store
     */
    private ArrayStore getBackingStoreForArray(AbstractMemberMetaData mmd, ClassLoaderResolver clr)
    {
        ArrayStore store;
        DatastoreContainerObject datastoreTable = getDatastoreContainerObject(mmd);
        if (datastoreTable != null)
        {
            store = newJoinArrayStore(mmd, clr, datastoreTable);
        }
View Full Code Here

Examples of org.datanucleus.store.scostore.ArrayStore

            NucleusLogger.REACHABILITY.debug(LOCALISER.msg("007009", mmd.getFullFieldName()));
        }

        // Update the datastore
        // TODO Do this more efficiently, removing elements no longer present, and adding new ones
        ArrayStore backingStore = (ArrayStore) storeMgr.getBackingStoreForField(sm.getObjectManager().getClassLoaderResolver(), mmd, null);
        backingStore.clear(sm);
        backingStore.set(sm, value);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.