Package org.apache.bookkeeper.versioning

Examples of org.apache.bookkeeper.versioning.Version


    }

    @Override
    public void writeLedgerMetadata(final long ledgerId, final LedgerMetadata metadata,
                                    final GenericCallback<Void> cb) {
        Version v = metadata.getVersion();
        if (Version.NEW == v || !(v instanceof ZkVersion)) {
            cb.operationComplete(BKException.Code.MetadataVersionException, null);
            return;
        }
        final ZkVersion zv = (ZkVersion) v;
View Full Code Here


                            owner = HubInfo.parse(new String(data));
                        }
                    } catch (HubInfo.InvalidHubInfoException ihie) {
                        logger.warn("Failed to parse hub info for topic " + topic.toStringUtf8(), ihie);
                    }
                    Version version = value.getVersion();
                    callback.operationFinished(ctx, new Versioned<HubInfo>(owner, version));
                }
            }, ctx);
        }
View Full Code Here

    }

    @Override
    public void writeLedgerMetadata(final long ledgerId, final LedgerMetadata metadata,
                                    final GenericCallback<Void> cb) {
        Version v = metadata.getVersion();
        if (Version.NEW == v || !(v instanceof ZkVersion)) {
            cb.operationComplete(BKException.Code.MetadataVersionException, null);
            return;
        }
        final ZkVersion zv = (ZkVersion) v;
View Full Code Here

                                    new Object[] { addr, topic.toStringUtf8() });
                        // no data found
                        choose(Version.NEW);
                        return;
                    }
                    final Version ownerVersion = owner.getVersion();
                    if (null == owner.getValue()) {
                        logger.info("{} : Invalid owner found for topic {}",
                                    new Object[] { addr, topic.toStringUtf8() });
                        choose(ownerVersion);
                        return;
View Full Code Here

    @Test(timeout=60000)
    public void testInvalidVersion() {
        ZkVersion zkVersion = new ZkVersion(99);
        try {
            zkVersion.compare(new Version() {
                @Override
                public Occurred compare(Version v) {
                    return Occurred.AFTER;
                }
            });
View Full Code Here

     */
    protected void putAndCheck(String recordId, String name,
                                      Integer counter, Version version,
                                      Record expected, Code expectedCode)
    throws Exception {
        Version retVersion = null;
        Code code = Code.OperationFailure;
        try {
            retVersion = myTable.put(recordId, makeValue(name, counter), version);
            code = Code.OK;
        } catch (MSException.BadVersionException bve) {
View Full Code Here

        final String name = "get";
        final Integer counter = getRandom();

        // put test item
        Version version = myTable.put(RECORDID, makeValue(name, counter), Version.NEW);
        assertNotNull(version);

        // fetch with all fields
        vv = getExistRecordFields(RECORDID, ALL_FIELDS);
        checkExpectedValue(vv, name, counter, version);
View Full Code Here

    @Test(timeout=60000)
    public void testPut() throws Exception {
        final Integer counter = getRandom();
        final String name = "put";

        Version version;

        /**
         * test correct version put
         */
        // put test item
View Full Code Here

     */
    @Test(timeout=60000)
    public void testRemove() throws Exception {
        final Integer counter = getRandom();
        final String name = "remove";
        Version version;

        // insert test item
        version = myTable.put(RECORDID, makeValue(name, counter), Version.NEW);
        assertNotNull(version);

View Full Code Here

        public void merge(Record record) {
            merge(record.name, record.counter, record.version);
        }

        public void checkEqual(Versioned<Value> vv) {
            Version v = vv.getVersion();
            Value value = vv.getValue();

            assertEquals(name, getFieldFromValue(value, FIELD_NAME));

            String c = getFieldFromValue(value, FIELD_COUNTER);
View Full Code Here

TOP

Related Classes of org.apache.bookkeeper.versioning.Version

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.