Package com.rackspacecloud.blueflood.types

Examples of com.rackspacecloud.blueflood.types.Locator


    @Test
    public void testTypedGet() throws Exception {
        MetadataCache cache = MetadataCache.createLoadingCacheInstance(new TimeValue(5, TimeUnit.MINUTES), 1);
        cache.setIO(io);
        Locator loc1 = Locator.createLocatorFromPathComponents("acOne", "ent", "chk", "mz", "met");
        String expectedString = "expected";
       
        cache.put(loc1, "str", expectedString);

        Assert.assertEquals(expectedString, cache.get(loc1, "str", String.class));
View Full Code Here


        cache.setIO(astIO);
       
        // DO NOT SET USING LOCAL IO INSTANCE!!!!
       
        // put an get a value with the old IO
        Locator loc = Locator.createLocatorFromPathComponents("io_replacment", "a", "b", "c");
        Assert.assertNull(cache.get(loc, "foo"));
        cache.put(loc, "foo", "bar");
        Assert.assertNotNull(cache.get(loc, "foo"));
        Assert.assertEquals("bar", cache.get(loc, "foo"));
       
View Full Code Here

    @Test
    public void testPersistence() throws Exception {
        MetadataCache cache0 = MetadataCache.createLoadingCacheInstance();
        cache0.setIO(new InMemoryMetadataIO());
       
        Locator l0 = Locator.createLocatorFromPathComponents("1", "a", "b");
        Locator l1 = Locator.createLocatorFromPathComponents("1", "c", "d");
        cache0.put(l0, "foo" , "l0_foo");
        cache0.put(l0, "bar", "l0_bar");
        cache0.put(l1, "zee", "zzzzz");
       
        File f = File.createTempFile("metadatacache_persistence", "txt");
View Full Code Here

        Assert.assertTrue(Configuration.getInstance().getBooleanProperty(CoreConfig.META_CACHE_BATCHED_WRITES));

        MetadataCache cache = MetadataCache.createLoadingCacheInstance();

        // Write some data to metadata cache.
        Locator l0 = Locator.createLocatorFromPathComponents("1", "a", "b");
        Locator l1 = Locator.createLocatorFromPathComponents("1", "c", "d");
        cache.put(l0, "foo" , "l0_foo");
        cache.put(l0, "bar", "l0_bar");
        cache.put(l1, "zee", "zzzzz");

        // Wait until the batch timer kicks off and flushes things to disk.
View Full Code Here

        Assert.assertTrue(Configuration.getInstance().getBooleanProperty(CoreConfig.META_CACHE_BATCHED_READS));

        MetadataCache cache = MetadataCache.createLoadingCacheInstance();

        // Write some data to metadata cache.
        Locator l0 = Locator.createLocatorFromPathComponents("1", "a", "b");
        Locator l1 = Locator.createLocatorFromPathComponents("1", "c", "d");

        AstyanaxMetadataIO metadataIO = new AstyanaxMetadataIO();
        Table<Locator, String, String> metaToWrite = HashBasedTable.create();

        // By the pass the cache and write to disk directly.
View Full Code Here

        final Timer timer = new Timer("UDP Broacast Timer " + id);
        final long period = 1000 / numPerSecond;
        final EventLoopGroup group = new NioEventLoopGroup();

        // My locator will be tentant_${id},udp_int_metric.
        final Locator locator = Locator.createLocatorFromPathComponents("tenant_" + id, "udp_int_metric");
        log.info("Sending metrics for {} starting {}", locator, System.currentTimeMillis());

        try {

            // netty UDP boilerplate.
View Full Code Here

                    classCastExceptionMeter.mark();
                    continue;
                }

                IMetric metric = (IMetric)obj;
                Locator locator = metric.getLocator();
                Discovery md = new Discovery(locator.getTenantId(), locator.getMetricName());

                Map<String, Object> info = new HashMap<String, Object>();


                if (obj instanceof  Metric && getUnit((Metric)metric) != null) { // metric units may be null
View Full Code Here

    }

    public static void main(String args[]) {
        Map<String, Object> options = parseOptions(args);

        Locator locator = Locator.createLocatorFromPathComponents(
                (String) options.get(TENANT_ID),
                (String) options.get(METRIC));

        AstyanaxReader reader = AstyanaxReader.getInstance();
View Full Code Here

                                    postExecutor.shutdown();
                                   
                                    break;
                                }
                               
                                final Locator locatorCapture = locator;
                                final Row<Locator, Long> row = rows.getRow(locator);
                               
                                // send copy commands to the write thread pool.
                                destWriteExecutor.submit(new Runnable() {
                                    public void run() {
                                        // back out if we've processed our quota of rows.
                                        if (processedKeys.get() >= keyLimit) {
                                            return;
                                        }
                                       
                                        // copy the column.
                                        MutationBatch batch = dstKeyspace.prepareMutationBatch();
                                        ColumnListMutation<Long> mutation = batch.withRow(columnFamily, locatorCapture);

                                        assert ttl != 0;
                                        long colCount = 0;
                                        for (Column<Long> c : row.getColumns()) {
                                            mutation.putColumn(c.getName(), c.getByteBufferValue(), ttl);
                                            colCount += 1;
                                        }
                                        columnsTransferred.addAndGet(colCount);
                                       
                                        // save it, submit a log message to be shown later.
                                        try {
                                            batch.execute();
                                            if (verify && random.nextFloat() < VERIFY_PERCENT) {
                                                verifyExecutor.submit(new Runnable() {public void run() {
                                                    try {
                                                        ColumnList<Long> srcData = srcKeyspace.prepareQuery(columnFamily).getKey(locatorCapture)
                                                                .withColumnRange(range)
                                                                .execute()
                                                                .getResult();
                                                        ColumnList<Long> dstData = dstKeyspace.prepareQuery(columnFamily).getKey(locatorCapture)
                                                                .withColumnRange(range)
                                                                .execute()
                                                                .getResult();
                                                       
                                                        checkSameResults(srcData, dstData);
                                                        postExecutor.submit(new Runnable() {public void run() {
                                                            out.println(String.format("verified %s", locatorCapture.toString()));
                                                        }});
                                                    } catch (ConnectionException ex) {
                                                        stopAll.set(true);
                                                        out.println("There was an error verifying data: " + ex.getMessage());
                                                        ex.printStackTrace(out);
                                                    } catch (Exception ex) {
                                                        stopAll.set(true);
                                                        out.println(ex.getMessage() + " " + locatorCapture.toString());
                                                    }
                                                }});
                                            }
                                           
                                            final long fColCount = colCount;
                                            postExecutor.submit(new Runnable() {
                                                public void run() {
                                                    int rowIteration = processedKeys.incrementAndGet();
                                                    long colsPerSecond = columnsTransferred.get() / Math.max(1, (nowInSeconds() - startClockTime));
                                                    out.println(String.format("%d copied %d for %s (%d m/s), %d", rowIteration, fColCount, locatorCapture.toString(), colsPerSecond, columnsTransferred.get()));
                                                    heartbeat.set(System.currentTimeMillis());
                                                }
                                            });
                                           
                                            // possibly throttle if we've sent a lot of columns.
View Full Code Here

TOP

Related Classes of com.rackspacecloud.blueflood.types.Locator

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.