Examples of Keyspace


Examples of com.fasterxml.clustermate.api.KeySpace

    {
        _stuff = stuff;
        _serviceConfig = stuff.getServiceConfig();
        _stores = stores;
        _startTime = startTime;
        _keyspace = new KeySpace(_serviceConfig.cluster.clusterKeyspaceSize);
    }
View Full Code Here

Examples of com.netflix.astyanax.Keyspace

    @SuppressWarnings("unchecked")
    public void simpleReadWriteCompositeTest() {
        boolean fail = false;
        try {
            AstyanaxContext<Keyspace> context = newContext("localhost:9160", KEYSPACE);
            Keyspace ks = context.getEntity();
            ColumnFamily<String, Composite> cf = new ColumnFamily<String, Composite>("composite",
                    StringSerializer.get(), CompositeSerializer.get());

            MutationBatch mutation = ks.prepareMutationBatch();

            mutation.withRow(cf, "mykey").putColumn(makeStringComposite("foo", "bar"),
                    "Hello Composite Column Range Query");
            mutation.withRow(cf, "mykey").putColumn(makeStringComposite("foo", "baz"), "My dog has fleas");
            mutation.withRow(cf, "mykey").putColumn(makeStringComposite("fzz", "baz"), "It is snowing");

            mutation.execute();

            // simple column fetch
            ColumnFamilyQuery<String, Composite> query = ks.prepareQuery(cf);
            Column<Composite> result = query.getKey("mykey").getColumn(makeStringComposite("foo", "bar")).execute()
                    .getResult();
            LOG.debug(result.getStringValue());

            // build up a composite range query
View Full Code Here

Examples of com.netflix.astyanax.Keyspace

    public void twoDimensionalCompositeRangeTest() {
        boolean fail = false;
        try {
            final String rowkey = "mykey2";
            AstyanaxContext<Keyspace> context = newContext("localhost:9160", KEYSPACE);
            Keyspace ks = context.getEntity();
            ColumnFamily<String, Composite> cf = new ColumnFamily<String, Composite>("composite2",
                    StringSerializer.get(), CompositeSerializer.get());

            MutationBatch mutation = ks.prepareMutationBatch();
           
            List<String> combinations = combinationsWithRepitition("abcdef", 3);
           
            for(String str : combinations){
                LOG.debug("Will insert '{}'", str);
                mutation.withRow(cf, rowkey).putColumn(makeStringComposite(str.substring(0,1), str.substring(1,2), str.substring(2,3)), str);
            }

            mutation.execute();

            // build up a composite range query
            Composite start = makeStringEqualityComposite(new String[] { "a", "a", "a"}, new ComponentEquality[] {
                    ComponentEquality.EQUAL,ComponentEquality.EQUAL, ComponentEquality.EQUAL });
            Composite end = makeStringEqualityComposite(new String[] { "a", "a", "b"}, new ComponentEquality[] {
                    ComponentEquality.EQUAL,ComponentEquality.EQUAL, ComponentEquality.EQUAL });

            ColumnFamilyQuery<String, Composite> query = ks.prepareQuery(cf);
            ColumnList<Composite> results = query.getKey(rowkey)
                    .withColumnRange(start.serialize(), end.serialize(), false, 100).execute().getResult();
            LOG.debug("Query matched {} results.", results.size());
            for (Composite columnKey : results.getColumnNames()) {
//                LOG.debug("Component(0): {}", columnKey.getComponent(0).getValue(StringSerializer.get()));
View Full Code Here

Examples of com.netflix.astyanax.Keyspace

        // wait very briefly for the batch to complete
        Thread.sleep(250);

        AstyanaxContext<Keyspace> astyContext = newContext("localhost:9160", KEYSPACE);
        Keyspace ks = astyContext.getEntity();

        Column<String> result = ks
                .prepareQuery(new ColumnFamily<String, String>("users", StringSerializer.get(), StringSerializer.get()))
                .getKey("42").getColumn("VALUE").execute().getResult();
        assertEquals("42", result.getStringValue());

    }
View Full Code Here

Examples of com.netflix.astyanax.Keyspace

        // wait very briefly for the batch to complete
        Thread.sleep(250);

        AstyanaxContext<Keyspace> astyContext = newContext("localhost:9160", KEYSPACE);
        Keyspace ks = astyContext.getEntity();

        Column<String> result = ks
                .prepareQuery(
                        new ColumnFamily<String, String>("Counts", StringSerializer.get(), StringSerializer.get()))
                .getKey("1").getColumn("MyCountColumn").execute().getResult();
        assertEquals(1L, result.getLongValue());
    }
View Full Code Here

Examples of com.netflix.astyanax.Keyspace

        }
    }
   
    public static void createCounterColumnFamily(AstyanaxContext<Cluster> ctx,String ks, String cf) throws ConnectionException{
        Cluster cluster = ctx.getEntity();
        Keyspace keyspace = cluster.getKeyspace(ks);
        if(keyspace != null){
            LOG.warn("Keyspace {} already exists.", ks);
        }
        KeyspaceDefinition ksDef = cluster.makeKeyspaceDefinition();
View Full Code Here

Examples of com.netflix.astyanax.Keyspace

        Tuple tuple = new MockTuple(fields, values);

        client.writeTuple(tuple, tupleMapper);

        AstyanaxContext<Keyspace> context = newContext("localhost:9160", KEYSPACE);
        Keyspace ks = context.getEntity();

        Column<String> result = ks
                .prepareQuery(
                        new ColumnFamily<SimpleComposite, String>("simple",
                                new AnnotatedCompositeSerializer<SimpleComposite>(SimpleComposite.class),
                                StringSerializer.get())).getKey(new SimpleComposite("key1val", "key2val"))
                .getColumn("foo").execute().getResult();
View Full Code Here

Examples of com.netflix.astyanax.Keyspace

        }
       
       
       
        AstyanaxContext<Keyspace> context = newContext("localhost:9160", KEYSPACE);
        Keyspace ks = context.getEntity();
       
        AnnotatedCompositeSerializer<Composite2> acs = new AnnotatedCompositeSerializer<Composite2>(Composite2.class);
       
        ColumnFamily<String, Composite2> cf = new ColumnFamily<String, Composite2>("generic", StringSerializer.get(), acs);
       
        MutationBatch mutation = ks.prepareMutationBatch();
       
       
       
        mutation.withRow(cf, "foo").putColumn(c2, "Hello World");
       
View Full Code Here

Examples of com.twitter.cassie.Keyspace

    cluster = new Cluster("host1,host2", NullStatsReceiver$.MODULE$).mapHostsEvery(new Duration(0));
  }

  @Test
  public void test() {
    Keyspace ks = cluster.keyspace("blah").connect();
    assertEquals(ks.name(), "blah");
  }
View Full Code Here

Examples of me.prettyprint.hector.api.Keyspace

  }

  private void assertColumnExists(String keyspace, String cf, String key, String column) {
    ColumnPath cp = new ColumnPath(cf);
    cp.setColumn(StringUtils.bytes(column));
    Keyspace ks = HFactory.createKeyspace(keyspace, cluster);
    ColumnQuery<String, String, String> columnQuery = HFactory.createStringColumnQuery(ks);
    assertNotNull(String.format("Should have value for %s.%s[%s][%s]", keyspace, cf, key, column),
        columnQuery.setColumnFamily(cf).setKey(key).setName(column).execute().get().getValue());
        //client.getKeyspace(keyspace).getColumn(key, cp));
    //cluster.releaseClient(client);
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.