Package org.apache.bookkeeper.metastore

Examples of org.apache.bookkeeper.metastore.Value


                                    metadata.setVersion(version);
                                    ledgerCb.operationComplete(BKException.Code.OK, lid);
                                }
                            };

                            ledgerTable.put(ledgerId2Key(lid), new Value().setField(META_FIELD, metadata.serialize()),
                                    Version.NEW, msCallback, null);
                            zk.delete(idPathName, -1, new AsyncCallback.VoidCallback() {
                                @Override
                                public void processResult(int rc, String path, Object ctx) {
                                    if (rc != KeeperException.Code.OK.intValue()) {
View Full Code Here


        }

        @Override
        public void writeLedgerMetadata(final long ledgerId, final LedgerMetadata metadata,
                final GenericCallback<Void> cb) {
            Value data = new Value().setField(META_FIELD, metadata.serialize());

            LOG.debug("Writing ledger {} metadata, version {}", new Object[] { ledgerId, metadata.getVersion() });

            final String key = ledgerId2Key(ledgerId);
            MetastoreCallback<Version> msCallback = new MetastoreCallback<Version>() {
View Full Code Here

        }

        @Override
        public void writeOwnerInfo(final ByteString topic, final HubInfo owner, final Version version,
                final Callback<Version> callback, Object ctx) {
            Value value = new Value();
            value.setField(OWNER_FIELD, owner.toString().getBytes());

            ownerTable.put(topic.toStringUtf8(), value, version, new MetastoreCallback<Version>() {
                @Override
                public void complete(int rc, Version ver, Object ctx) {
                    if (MSException.Code.OK.getCode() == rc) {
View Full Code Here

        }

        @Override
        public void writeTopicPersistenceInfo(final ByteString topic, LedgerRanges ranges, final Version version,
                final Callback<Version> callback, Object ctx) {
            Value value = new Value();
            value.setField(PERSIST_FIELD, TextFormat.printToString(ranges).getBytes());

            persistTable.put(topic.toStringUtf8(), value, version, new MetastoreCallback<Version>() {
                @Override
                public void complete(int rc, Version ver, Object ctx) {
                    if (MSException.Code.OK.getCode() == rc) {
View Full Code Here

            return new StringBuilder(topic.toStringUtf8()).append(TOPIC_SUB_FIRST_SEPARATOR)
                    .append(subscriberId.toStringUtf8()).toString();
        }

        private Value subscriptionData2Value(SubscriptionData subData) {
            Value value = new Value();
            if (subData.hasState()) {
                value.setField(SUB_STATE_FIELD, TextFormat.printToString(subData.getState()).getBytes());
            }
            if (subData.hasPreferences()) {
                value.setField(SUB_PREFS_FIELD, TextFormat.printToString(subData.getPreferences()).getBytes());
            }
            return value;
        }
View Full Code Here

        @Override
        public void createSubscriptionData(final ByteString topic, final ByteString subscriberId,
                final SubscriptionData subData, final Callback<Version> callback, Object ctx) {
            String key = getSubscriptionKey(topic, subscriberId);
            Value value = subscriptionData2Value(subData);

            subTable.put(key, value, Version.NEW, new MetastoreCallback<Version>() {
                @Override
                public void complete(int rc, Version ver, Object ctx) {
                    if (rc == MSException.Code.OK.getCode()) {
View Full Code Here

        @Override
        public void updateSubscriptionData(final ByteString topic, final ByteString subscriberId,
                final SubscriptionData subData, final Version version, final Callback<Version> callback,
                final Object ctx) {
            String key = getSubscriptionKey(topic, subscriberId);
            Value value = subscriptionData2Value(subData);

            subTable.put(key, value, version, new MetastoreCallback<Version>() {
                @Override
                public void complete(int rc, Version version, Object ctx) {
                    if (rc == MSException.Code.OK.getCode()) {
View Full Code Here

                                    metadata.setVersion(version);
                                    ledgerCb.operationComplete(BKException.Code.OK, lid);
                                }
                            };

                            ledgerTable.put(ledgerId2Key(lid), new Value().setField(META_FIELD, metadata.serialize()),
                                    Version.NEW, msCallback, null);
                            zk.delete(idPathName, -1, new AsyncCallback.VoidCallback() {
                                @Override
                                public void processResult(int rc, String path, Object ctx) {
                                    if (rc != KeeperException.Code.OK.intValue()) {
View Full Code Here

        }

        @Override
        public void writeLedgerMetadata(final long ledgerId, final LedgerMetadata metadata,
                final GenericCallback<Void> cb) {
            Value data = new Value().setField(META_FIELD, metadata.serialize());

            LOG.debug("Writing ledger {} metadata, version {}", new Object[] { ledgerId, metadata.getVersion() });

            final String key = ledgerId2Key(ledgerId);
            MetastoreCallback<Version> msCallback = new MetastoreCallback<Version>() {
View Full Code Here

                                    metadata.setVersion(version);
                                    ledgerCb.operationComplete(BKException.Code.OK, lid);
                                }
                            };

                            ledgerTable.put(ledgerId2Key(lid), new Value().setField(META_FIELD, metadata.serialize()),
                                    Version.NEW, msCallback, null);
                            zk.delete(idPathName, -1, new AsyncCallback.VoidCallback() {
                                @Override
                                public void processResult(int rc, String path, Object ctx) {
                                    if (rc != KeeperException.Code.OK.intValue()) {
View Full Code Here

TOP

Related Classes of org.apache.bookkeeper.metastore.Value

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.