Package com.rackspacecloud.blueflood.service

Examples of com.rackspacecloud.blueflood.service.SlotState


        String stringRep = StringSerializer.get().fromByteBuffer(byteBuffer);
        Granularity g = granularityFromStateCol(stringRep);
        Integer slot = slotFromStateCol(stringRep);
        UpdateStamp.State state = stateFromCode(stateCodeFromStateCol(stringRep));

        return new SlotState(g, slot, state);
    }
View Full Code Here


            ColumnListMutation<SlotState> mutation = mutationBatch.withRow(CassandraModel.CF_METRICS_STATE, (long)shard);
            for (Map.Entry<Granularity, Map<Integer, UpdateStamp>> granEntry : updates.entrySet()) {
                Granularity g = granEntry.getKey();
                for (Map.Entry<Integer, UpdateStamp> entry : granEntry.getValue().entrySet()) {
                    // granularity,slot,state
                    SlotState slotState = new SlotState(g, entry.getKey(), entry.getValue().getState());
                    mutation.putColumn(slotState, entry.getValue().getTimestamp());
                    /*
                      Note: we used to set the timestamp of the column to entry.getValue().getTimestamp() * 1000 over here.
                      This block of code is dangerous. Consider you are getting out of order metrics M1 and M2, with collection times T1 and T2 with T2>T1, belonging to same slot
                      Assume M2 arrives first. The slot gets marked active and rolled up and the state is set as Rolled. Now, assume M1 arrives. We update the slot state to active,
View Full Code Here

    @Test
    public void testToFromByteBuffer() {
        ByteBuffer origBuff = StringSerializer.get().toByteBuffer("metrics_full,1,X");
        Assert.assertNotNull(origBuff);

        SlotState state = SlotStateSerializer.get().fromByteBuffer(origBuff.duplicate());
        Assert.assertEquals(state.getGranularity(), Granularity.FULL);
        Assert.assertEquals(state.getSlot(), 1);
        Assert.assertEquals(state.getState(), UpdateStamp.State.Rolled);

        ByteBuffer newBuff = SlotStateSerializer.get().toByteBuffer(state);
        Assert.assertEquals(origBuff, newBuff);
    }
View Full Code Here

TOP

Related Classes of com.rackspacecloud.blueflood.service.SlotState

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.