Examples of BytesToken


Examples of org.apache.cassandra.dht.BytesToken

            SystemTable.updateTokens(current);

        List<Token> tokens = new ArrayList<Token>()
        {{
            for (int i = 0; i < 9; i++)
                add(new BytesToken(ByteBufferUtil.bytes(String.format("token%d", i))));
        }};

        SystemTable.updateTokens(tokens);
        int count = 0;
View Full Code Here

Examples of org.apache.cassandra.dht.BytesToken

    }

    @Test
    public void testNonLocalToken() throws UnknownHostException
    {
        BytesToken token = new BytesToken(ByteBufferUtil.bytes("token3"));
        InetAddress address = InetAddress.getByName("127.0.0.2");
        SystemTable.updateTokens(address, Collections.<Token>singletonList(token));
        assert SystemTable.loadTokens().get(address).contains(token);
        SystemTable.removeEndpoint(address);
        assert !SystemTable.loadTokens().containsValue(token);
View Full Code Here

Examples of org.apache.cassandra.dht.BytesToken

        return String.format("%03d", key);
    }

    private static Bounds<RowPosition> boundsFor(int start, int end)
    {
        return new Bounds<RowPosition>(new BytesToken(toKey(start).getBytes()).minKeyBound(),
                                       new BytesToken(toKey(end).getBytes()).maxKeyBound());
    }
View Full Code Here

Examples of org.apache.cassandra.dht.BytesToken

    }


    private static Range<Token> rangeFor(int start, int end)
    {
        return new Range<Token>(new BytesToken(toKey(start).getBytes()),
                                new BytesToken(toKey(end).getBytes()));
    }
View Full Code Here

Examples of org.apache.cassandra.dht.BytesToken

        // So to make sure cleanup erase everything here, we give the localhost the tiniest possible range.
        TokenMetadata tmd = StorageService.instance.getTokenMetadata();
        byte[] tk1 = new byte[1], tk2 = new byte[1];
        tk1[0] = 2;
        tk2[0] = 1;
        tmd.updateNormalToken(new BytesToken(tk1), InetAddress.getByName("127.0.0.1"));
        tmd.updateNormalToken(new BytesToken(tk2), InetAddress.getByName("127.0.0.2"));

        CompactionManager.instance.performCleanup(cfs, new CounterId.OneShotRenewer());

        // row data should be gone
        rows = Util.getRangeSlice(cfs);
View Full Code Here

Examples of org.apache.cassandra.dht.BytesToken

            SystemKeyspace.updateTokens(current);

        List<Token> tokens = new ArrayList<Token>()
        {{
            for (int i = 0; i < 9; i++)
                add(new BytesToken(ByteBufferUtil.bytes(String.format("token%d", i))));
        }};

        SystemKeyspace.updateTokens(tokens);
        int count = 0;
View Full Code Here

Examples of org.apache.cassandra.dht.BytesToken

    }

    @Test
    public void testNonLocalToken() throws UnknownHostException
    {
        BytesToken token = new BytesToken(ByteBufferUtil.bytes("token3"));
        InetAddress address = InetAddress.getByName("127.0.0.2");
        SystemKeyspace.updateTokens(address, Collections.<Token>singletonList(token));
        assert SystemKeyspace.loadTokens().get(address).contains(token);
        SystemKeyspace.removeEndpoint(address);
        assert !SystemKeyspace.loadTokens().containsValue(token);
View Full Code Here

Examples of org.apache.cassandra.dht.BytesToken

        // So to make sure cleanup erase everything here, we give the localhost the tiniest possible range.
        TokenMetadata tmd = StorageService.instance.getTokenMetadata();
        byte[] tk1 = new byte[1], tk2 = new byte[1];
        tk1[0] = 2;
        tk2[0] = 1;
        tmd.updateNormalToken(new BytesToken(tk1), InetAddress.getByName("127.0.0.1"));
        tmd.updateNormalToken(new BytesToken(tk2), InetAddress.getByName("127.0.0.2"));

        CompactionManager.instance.performCleanup(cfs, new NodeId.OneShotRenewer());

        // row data should be gone
        rows = Util.getRangeSlice(cfs);
View Full Code Here

Examples of org.apache.cassandra.dht.BytesToken

    private void testStreamRequestMessageWrite() throws IOException
    {
        Collection<Range<Token>> ranges = new ArrayList<Range<Token>>();
        for (int i = 0; i < 5; i++)
            ranges.add(new Range<Token>(new BytesToken(ByteBufferUtil.bytes(Integer.toString(10*i))), new BytesToken(ByteBufferUtil.bytes(Integer.toString(10*i+5)))));
        List<ColumnFamilyStore> stores = Collections.singletonList(Table.open("Keyspace1").getColumnFamilyStore("Standard1"));
        StreamRequestMessage msg0 = new StreamRequestMessage(FBUtilities.getBroadcastAddress(), ranges, "Keyspace1", stores, 123L, OperationType.RESTORE_REPLICA_COUNT);
        StreamRequestMessage msg1 = new StreamRequestMessage(FBUtilities.getBroadcastAddress(), makePendingFile(true, 100, OperationType.BOOTSTRAP), 124L);
        StreamRequestMessage msg2 = new StreamRequestMessage(FBUtilities.getBroadcastAddress(), makePendingFile(false, 100, OperationType.BOOTSTRAP), 124L);

View Full Code Here

Examples of org.apache.cassandra.dht.BytesToken

        // So to make sure cleanup erase everything here, we give the localhost the tiniest possible range.
        TokenMetadata tmd = StorageService.instance.getTokenMetadata();
        byte[] tk1 = new byte[1], tk2 = new byte[1];
        tk1[0] = 2;
        tk2[0] = 1;
        tmd.updateNormalToken(new BytesToken(tk1), InetAddress.getByName("127.0.0.1"));
        tmd.updateNormalToken(new BytesToken(tk2), InetAddress.getByName("127.0.0.2"));

        CompactionManager.instance.performCleanup(cfs, new NodeId.OneShotRenewer());

        // row data should be gone
        rows = Util.getRangeSlice(cfs);
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.