Package voldemort.serialization

Examples of voldemort.serialization.StringSerializer


    }

    @Override
    public Store<String, String, String> getStore() {
        return SerializingStore.wrap(new InMemoryStorageEngine<ByteArray, byte[], byte[]>("test"),
                                     new StringSerializer(),
                                     new StringSerializer(),
                                     new StringSerializer());
    }
View Full Code Here


    }

    public void testKeyIterationWithSerialization() {
        StorageEngine<ByteArray, byte[], byte[]> store = getStorageEngine();
        StorageEngine<String, String, String> stringStore = new SerializingStorageEngine<String, String, String>(store,
                                                                                                                 new StringSerializer(),
                                                                                                                 new StringSerializer(),
                                                                                                                 new StringSerializer());
        Map<String, String> vals = ImmutableMap.of("a", "a", "b", "b", "c", "c", "d", "d", "e", "e");
        for(Map.Entry<String, String> entry: vals.entrySet())
            stringStore.put(entry.getKey(), new Versioned<String>(entry.getValue()), null);
        ClosableIterator<String> iter = stringStore.keys();
        int count = 0;
View Full Code Here

    }

    public void testIterationWithSerialization() {
        StorageEngine<ByteArray, byte[], byte[]> store = getStorageEngine();
        StorageEngine<String, String, String> stringStore = SerializingStorageEngine.wrap(store,
                                                                                          new StringSerializer(),
                                                                                          new StringSerializer(),
                                                                                          new StringSerializer());
        Map<String, String> vals = ImmutableMap.of("a", "a", "b", "b", "c", "c", "d", "d", "e", "e");
        for(Map.Entry<String, String> entry: vals.entrySet())
            stringStore.put(entry.getKey(), new Versioned<String>(entry.getValue()), null);
        ClosableIterator<Pair<String, Versioned<String>>> iter = stringStore.entries();
        int count = 0;
View Full Code Here

    @Before
    public void setUp() throws Exception {
        this.nodeId = 0;
        this.time = SystemTime.INSTANCE;
        Serializer<String> serializer = new StringSerializer();
        MockStoreClientFactory factory = new MockStoreClientFactory(serializer,
                                                                    serializer,
                                                                    null,
                                                                    serializer,
                                                                    nodeId,
View Full Code Here

        return Arrays.asList(new Object[][] { { true }, { false } });
    }

    @Test
    public void testCaching() {
        StoreClientFactory inner = new MockStoreClientFactory(new StringSerializer(),
                                                              new StringSerializer(),
                                                              null);
        StoreClientFactory spyFactory = spy(inner);
        StoreClientFactory cachingFactory = new CachingStoreClientFactory(spyFactory);
        TimeBasedInconsistencyResolver<Object> resolver = new TimeBasedInconsistencyResolver<Object>();
View Full Code Here

        verify(spyFactory, times(1)).getStoreClient("foo", null);
    }

    @Test
    public void testBootstrapAll() {
        StoreClientFactory inner = new MockStoreClientFactory(new StringSerializer(),
                                                              new StringSerializer(),
                                                              null);
        final DefaultStoreClient<Object, Object> aStoreClient = spy((DefaultStoreClient<Object, Object>) inner.getStoreClient("test1"));
        final DefaultStoreClient<Object, Object> bStoreClient = spy((DefaultStoreClient<Object, Object>) inner.getStoreClient("test2"));
        StoreClientFactory mocked = mock(StoreClientFactory.class);
View Full Code Here

        Iterator<Pair<ByteArray, Versioned<byte[]>>> entriesIterator = adminClient.bulkFetchOps.fetchEntries(nodeId,
                                                                                                             SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name(),
                                                                                                             partitionIdList,
                                                                                                             null,
                                                                                                             true);
        Serializer<String> serializer = new StringSerializer("UTF8");
        String keyObject = null;
        String valueObject = null;

        while(entriesIterator.hasNext()) {
            try {
                Pair<ByteArray, Versioned<byte[]>> kvPair = entriesIterator.next();
                byte[] keyBytes = kvPair.getFirst().get();
                byte[] valueBytes = kvPair.getSecond().getValue();
                keyObject = serializer.toObject(keyBytes);
                if(!keyObject.equals(MetadataVersionStoreUtils.VERSIONS_METADATA_KEY)) {
                    continue;
                }
                valueObject = serializer.toObject(valueBytes);
            } catch(Exception e) {
                System.err.println("Error while retrieving Metadata versions from node : " + nodeId
                                   + ". Exception = \n");
                e.printStackTrace();
                System.exit(-1);
View Full Code Here

                                                                                                     new Object[] { config });
            StorageEngine<ByteArray, byte[], byte[]> engine = storageConfig.getStore(TestUtils.makeStoreDefinition("test"),
                                                                                     TestUtils.makeSingleNodeRoutingStrategy());
            @SuppressWarnings("unchecked")
            final Store<String, byte[], byte[]> store = new SerializingStore(engine,
                                                                             new StringSerializer(),
                                                                             new IdentitySerializer(),
                                                                             null);

            final byte[] value = new byte[valueSize];
            new Random().nextBytes(value);
View Full Code Here

        target2.put(1, Versioned.value(Arrays.asList(values1)), null);
        target2.put(100, Versioned.value(Arrays.asList(values2)), null);
    }

    public Store<String, String, String> getEngine1(View<?, ?, ?, ?> valTrans) {
        Serializer<String> s = new StringSerializer();
        return SerializingStore.wrap(new ViewStorageEngine("test",
                                                           targetRaw1,
                                                           s,
                                                           s,
                                                           s,
View Full Code Here

                                                          TestUtils.makeSingleNodeRoutingStrategy());
        } else {
            store = new BdbStorageEngine(storeName, environment, database, new BdbRuntimeConfig());
        }
        StorageEngine<String, String, String> stringStore = SerializingStorageEngine.wrap(store,
                                                                                          new StringSerializer(),
                                                                                          new StringSerializer(),
                                                                                          new StringSerializer());
        Iterator<Pair<String, Versioned<String>>> iter = stringStore.entries();
        while(iter.hasNext()) {
            Pair<String, Versioned<String>> entry = iter.next();
            System.out.println(entry.getFirst() + " => " + entry.getSecond().getValue());
        }
View Full Code Here

TOP

Related Classes of voldemort.serialization.StringSerializer

Copyright © 2018 www.massapicom. 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.