diff --git a/.gitattributes b/.gitattributes
index a6a28fa4e83..b01b58a6e96 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -8,6 +8,6 @@
*.xml text
*.sh text
-# Files that should keep CLRF line endings
+# Files that should keep CRLF line endings
*.bat text eol=crlf
diff --git a/clients/streaming/src/main/java/com/emc/pravega/state/Update.java b/clients/streaming/src/main/java/com/emc/pravega/state/Update.java
index ef0f23c6470..d2464783e62 100644
--- a/clients/streaming/src/main/java/com/emc/pravega/state/Update.java
+++ b/clients/streaming/src/main/java/com/emc/pravega/state/Update.java
@@ -1,38 +1,38 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.emc.pravega.state;
-
-/**
- * An update to a StateT object coordinated via a {@link StateSynchronizer}.
- *
- * @param the type of the object being updated
- */
-public interface Update {
-
- /**
- * Return an object of type StateT that is the same as oldState with this update applied to it.
- * Invoking {@link Revisioned#getRevision()} on the result should return newRevision.
- *
- * @param oldState the state to which should be used as the basis for the new state.
- * @param newRevision the revision for the new state.
- * @return A state that represents a state with this update applied to it. (If StateT is mutable
- * and the update is done in-place this is the same object as oldState)
- */
- StateT applyTo(StateT oldState, Revision newRevision);
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.pravega.state;
+
+/**
+ * An update to a StateT object coordinated via a {@link StateSynchronizer}.
+ *
+ * @param the type of the object being updated
+ */
+public interface Update {
+
+ /**
+ * Return an object of type StateT that is the same as oldState with this update applied to it.
+ * Invoking {@link Revisioned#getRevision()} on the result should return newRevision.
+ *
+ * @param oldState the state to which should be used as the basis for the new state.
+ * @param newRevision the revision for the new state.
+ * @return A state that represents a state with this update applied to it. (If StateT is mutable
+ * and the update is done in-place this is the same object as oldState)
+ */
+ StateT applyTo(StateT oldState, Revision newRevision);
+
+}
diff --git a/clients/streaming/src/main/java/com/emc/pravega/stream/impl/ModelHelper.java b/clients/streaming/src/main/java/com/emc/pravega/stream/impl/ModelHelper.java
index 6e5ca282bae..d370537f88f 100644
--- a/clients/streaming/src/main/java/com/emc/pravega/stream/impl/ModelHelper.java
+++ b/clients/streaming/src/main/java/com/emc/pravega/stream/impl/ModelHelper.java
@@ -1,171 +1,171 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.emc.pravega.stream.impl;
-
-import com.emc.pravega.common.netty.PravegaNodeUri;
-import com.emc.pravega.controller.stream.api.v1.NodeUri;
-import com.emc.pravega.controller.stream.api.v1.Position;
-import com.emc.pravega.controller.stream.api.v1.ScalingPolicyType;
-import com.emc.pravega.controller.stream.api.v1.SegmentId;
-import com.emc.pravega.controller.stream.api.v1.StreamConfig;
-import com.emc.pravega.controller.stream.api.v1.TxnId;
-import com.emc.pravega.controller.stream.api.v1.TxnState;
-import com.emc.pravega.stream.ScalingPolicy;
-import com.emc.pravega.stream.Segment;
-import com.emc.pravega.stream.StreamConfiguration;
-import com.emc.pravega.stream.Transaction;
-import com.google.common.base.Preconditions;
-
-import java.util.AbstractMap;
-import java.util.AbstractMap.SimpleEntry;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.UUID;
-import java.util.stream.Collectors;
-
-/**
- * Provides translation (encode/decode) between the Model classes and its Thrift representation.
- */
-public final class ModelHelper {
-
- public static final UUID encode(TxnId txnId) {
- Preconditions.checkNotNull(txnId, "txnId");
- return new UUID(txnId.getHighBits(), txnId.getLowBits());
- }
-
- public static final TxnStatus encode(TxnState txnState) {
- Preconditions.checkNotNull(txnState, "txnState");
- return TxnStatus.valueOf(txnState.name());
- }
-
- public static final Segment encode(final SegmentId segment) {
- Preconditions.checkNotNull(segment, "Segment");
- return new Segment(segment.getScope(), segment.getStreamName(), segment.getNumber());
- }
-
- public static final ScalingPolicy encode(final com.emc.pravega.controller.stream.api.v1.ScalingPolicy policy) {
- Preconditions.checkNotNull(policy, "ScalingPolicy");
- return new ScalingPolicy(ScalingPolicy.Type.valueOf(policy.getType().name()), policy.getTargetRate(), policy.getScaleFactor(),
- policy.getMinNumSegments());
- }
-
- public static final StreamConfiguration encode(final StreamConfig config) {
- Preconditions.checkNotNull(config, "StreamConfig");
- return new StreamConfigurationImpl(config.getScope(),
- config.getName(),
- encode(config.getPolicy()));
- }
-
- public static final PositionImpl encode(final Position position) {
- Preconditions.checkNotNull(position, "Position");
- return new PositionImpl(encodeSegmentMap(position.getOwnedSegments()));
- }
-
- public static com.emc.pravega.common.netty.PravegaNodeUri encode(NodeUri uri) {
- return new com.emc.pravega.common.netty.PravegaNodeUri(uri.getEndpoint(), uri.getPort());
- }
-
- public static List> encode(Map keyRanges) {
- return keyRanges
- .entrySet()
- .stream()
- .map(x -> new AbstractMap.SimpleEntry<>(x.getKey(), x.getValue()))
- .collect(Collectors.toList());
- }
-
- public static Transaction.Status encode(TxnState status, String logString) {
- switch (status) {
- case COMMITTED:
- return Transaction.Status.COMMITTED;
- case ABORTED:
- return Transaction.Status.ABORTED;
- case OPEN:
- return Transaction.Status.OPEN;
- case SEALED:
- return Transaction.Status.SEALED;
- case UNKNOWN:
- throw new RuntimeException("Unknown transaction: " + logString);
- default:
- throw new IllegalStateException("Unknown status: " + status);
- }
- }
-
- public static final TxnId decode(UUID txnId) {
- Preconditions.checkNotNull(txnId, "txnId");
- return new TxnId(txnId.getMostSignificantBits(), txnId.getLeastSignificantBits());
- }
-
- public static final TxnState decode(TxnStatus txnStatus) {
- Preconditions.checkNotNull(txnStatus, "txnStatus");
- return TxnState.valueOf(txnStatus.name());
- }
-
- public static final SegmentId decode(final Segment segment) {
- Preconditions.checkNotNull(segment, "Segment");
- return new SegmentId().setScope(segment.getScope()).setStreamName(segment.getStreamName())
- .setNumber(segment.getSegmentNumber());
-
- }
-
- public static final com.emc.pravega.controller.stream.api.v1.ScalingPolicy decode(final ScalingPolicy policyModel) {
- Preconditions.checkNotNull(policyModel, "Policy");
- return new com.emc.pravega.controller.stream.api.v1.ScalingPolicy()
- .setType(ScalingPolicyType.valueOf(policyModel.getType().name())).setTargetRate(policyModel.getTargetRate())
- .setScaleFactor(policyModel.getScaleFactor()).setMinNumSegments(policyModel.getMinNumSegments());
- }
-
- public static final StreamConfig decode(final StreamConfiguration configModel) {
- Preconditions.checkNotNull(configModel, "StreamConfiguration");
- return new StreamConfig(configModel.getScope(),
- configModel.getName(),
- decode(configModel.getScalingPolicy()));
- }
-
- public static final Position decode(final PositionInternal position) {
- Preconditions.checkNotNull(position, "Position");
- return new Position(decodeSegmentMap(position.getOwnedSegmentsWithOffsets()));
- }
-
- public static NodeUri decode(PravegaNodeUri uri) {
- return new NodeUri(uri.getEndpoint(), uri.getPort());
- }
-
- public static final Map toSegmentOffsetMap(PositionInternal position) {
- return position.getOwnedSegmentsWithOffsets()
- .entrySet()
- .stream()
- .map(e -> new SimpleEntry<>(e.getKey().getSegmentNumber(), e.getValue()))
- .collect(Collectors.toMap(Entry::getKey, Entry::getValue));
- }
-
- private static Map encodeSegmentMap(final Map map) {
- Preconditions.checkNotNull(map);
- HashMap result = new HashMap<>();
- for (Entry entry : map.entrySet()) {
- result.put(encode(entry.getKey()), entry.getValue());
- }
- return result;
- }
-
- private static Map decodeSegmentMap(final Map map) {
- Preconditions.checkNotNull(map);
- return map.entrySet().stream().collect(Collectors.toMap(e -> decode(e.getKey()), Map.Entry::getValue));
- }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.pravega.stream.impl;
+
+import com.emc.pravega.common.netty.PravegaNodeUri;
+import com.emc.pravega.controller.stream.api.v1.NodeUri;
+import com.emc.pravega.controller.stream.api.v1.Position;
+import com.emc.pravega.controller.stream.api.v1.ScalingPolicyType;
+import com.emc.pravega.controller.stream.api.v1.SegmentId;
+import com.emc.pravega.controller.stream.api.v1.StreamConfig;
+import com.emc.pravega.controller.stream.api.v1.TxnId;
+import com.emc.pravega.controller.stream.api.v1.TxnState;
+import com.emc.pravega.stream.ScalingPolicy;
+import com.emc.pravega.stream.Segment;
+import com.emc.pravega.stream.StreamConfiguration;
+import com.emc.pravega.stream.Transaction;
+import com.google.common.base.Preconditions;
+
+import java.util.AbstractMap;
+import java.util.AbstractMap.SimpleEntry;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.UUID;
+import java.util.stream.Collectors;
+
+/**
+ * Provides translation (encode/decode) between the Model classes and its Thrift representation.
+ */
+public final class ModelHelper {
+
+ public static final UUID encode(TxnId txnId) {
+ Preconditions.checkNotNull(txnId, "txnId");
+ return new UUID(txnId.getHighBits(), txnId.getLowBits());
+ }
+
+ public static final TxnStatus encode(TxnState txnState) {
+ Preconditions.checkNotNull(txnState, "txnState");
+ return TxnStatus.valueOf(txnState.name());
+ }
+
+ public static final Segment encode(final SegmentId segment) {
+ Preconditions.checkNotNull(segment, "Segment");
+ return new Segment(segment.getScope(), segment.getStreamName(), segment.getNumber());
+ }
+
+ public static final ScalingPolicy encode(final com.emc.pravega.controller.stream.api.v1.ScalingPolicy policy) {
+ Preconditions.checkNotNull(policy, "ScalingPolicy");
+ return new ScalingPolicy(ScalingPolicy.Type.valueOf(policy.getType().name()), policy.getTargetRate(), policy.getScaleFactor(),
+ policy.getMinNumSegments());
+ }
+
+ public static final StreamConfiguration encode(final StreamConfig config) {
+ Preconditions.checkNotNull(config, "StreamConfig");
+ return new StreamConfigurationImpl(config.getScope(),
+ config.getName(),
+ encode(config.getPolicy()));
+ }
+
+ public static final PositionImpl encode(final Position position) {
+ Preconditions.checkNotNull(position, "Position");
+ return new PositionImpl(encodeSegmentMap(position.getOwnedSegments()));
+ }
+
+ public static com.emc.pravega.common.netty.PravegaNodeUri encode(NodeUri uri) {
+ return new com.emc.pravega.common.netty.PravegaNodeUri(uri.getEndpoint(), uri.getPort());
+ }
+
+ public static List> encode(Map keyRanges) {
+ return keyRanges
+ .entrySet()
+ .stream()
+ .map(x -> new AbstractMap.SimpleEntry<>(x.getKey(), x.getValue()))
+ .collect(Collectors.toList());
+ }
+
+ public static Transaction.Status encode(TxnState status, String logString) {
+ switch (status) {
+ case COMMITTED:
+ return Transaction.Status.COMMITTED;
+ case ABORTED:
+ return Transaction.Status.ABORTED;
+ case OPEN:
+ return Transaction.Status.OPEN;
+ case SEALED:
+ return Transaction.Status.SEALED;
+ case UNKNOWN:
+ throw new RuntimeException("Unknown transaction: " + logString);
+ default:
+ throw new IllegalStateException("Unknown status: " + status);
+ }
+ }
+
+ public static final TxnId decode(UUID txnId) {
+ Preconditions.checkNotNull(txnId, "txnId");
+ return new TxnId(txnId.getMostSignificantBits(), txnId.getLeastSignificantBits());
+ }
+
+ public static final TxnState decode(TxnStatus txnStatus) {
+ Preconditions.checkNotNull(txnStatus, "txnStatus");
+ return TxnState.valueOf(txnStatus.name());
+ }
+
+ public static final SegmentId decode(final Segment segment) {
+ Preconditions.checkNotNull(segment, "Segment");
+ return new SegmentId().setScope(segment.getScope()).setStreamName(segment.getStreamName())
+ .setNumber(segment.getSegmentNumber());
+
+ }
+
+ public static final com.emc.pravega.controller.stream.api.v1.ScalingPolicy decode(final ScalingPolicy policyModel) {
+ Preconditions.checkNotNull(policyModel, "Policy");
+ return new com.emc.pravega.controller.stream.api.v1.ScalingPolicy()
+ .setType(ScalingPolicyType.valueOf(policyModel.getType().name())).setTargetRate(policyModel.getTargetRate())
+ .setScaleFactor(policyModel.getScaleFactor()).setMinNumSegments(policyModel.getMinNumSegments());
+ }
+
+ public static final StreamConfig decode(final StreamConfiguration configModel) {
+ Preconditions.checkNotNull(configModel, "StreamConfiguration");
+ return new StreamConfig(configModel.getScope(),
+ configModel.getName(),
+ decode(configModel.getScalingPolicy()));
+ }
+
+ public static final Position decode(final PositionInternal position) {
+ Preconditions.checkNotNull(position, "Position");
+ return new Position(decodeSegmentMap(position.getOwnedSegmentsWithOffsets()));
+ }
+
+ public static NodeUri decode(PravegaNodeUri uri) {
+ return new NodeUri(uri.getEndpoint(), uri.getPort());
+ }
+
+ public static final Map toSegmentOffsetMap(PositionInternal position) {
+ return position.getOwnedSegmentsWithOffsets()
+ .entrySet()
+ .stream()
+ .map(e -> new SimpleEntry<>(e.getKey().getSegmentNumber(), e.getValue()))
+ .collect(Collectors.toMap(Entry::getKey, Entry::getValue));
+ }
+
+ private static Map encodeSegmentMap(final Map map) {
+ Preconditions.checkNotNull(map);
+ HashMap result = new HashMap<>();
+ for (Entry entry : map.entrySet()) {
+ result.put(encode(entry.getKey()), entry.getValue());
+ }
+ return result;
+ }
+
+ private static Map decodeSegmentMap(final Map map) {
+ Preconditions.checkNotNull(map);
+ return map.entrySet().stream().collect(Collectors.toMap(e -> decode(e.getKey()), Map.Entry::getValue));
+ }
+}
diff --git a/clients/streaming/src/test/java/com/emc/pravega/state/examples/MembershipSynchronizer.java b/clients/streaming/src/test/java/com/emc/pravega/state/examples/MembershipSynchronizer.java
index f07064928cd..4dfebe79471 100644
--- a/clients/streaming/src/test/java/com/emc/pravega/state/examples/MembershipSynchronizer.java
+++ b/clients/streaming/src/test/java/com/emc/pravega/state/examples/MembershipSynchronizer.java
@@ -1,247 +1,247 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.emc.pravega.state.examples;
-
-import com.emc.pravega.ClientFactory;
-import com.emc.pravega.state.InitialUpdate;
-import com.emc.pravega.state.Revision;
-import com.emc.pravega.state.Revisioned;
-import com.emc.pravega.state.StateSynchronizer;
-import com.emc.pravega.state.Update;
-import com.emc.pravega.stream.impl.JavaSerializer;
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.AbstractService;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.stream.Collectors;
-
-import lombok.Data;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class MembershipSynchronizer extends AbstractService {
-
- /**
- * How frequently to update the segment using a heartbeat.
- */
- private static final int UPDATE_INTERVAL_MILLIS = 1000;
-
- /**
- * Number of intervals behind before switching to unconditional updates.
- */
- private static final int UNCONDITIONAL_UPDATE_THRESHOLD = 3;
-
- /**
- * Number of intervals behind before we should stop executing for safety.
- */
- private static final int UNHEALTHY_THRESHOLD = 5;
-
- /**
- * Number of intervals behind before another host should be considered dead.
- */
- private static final int DEATH_THRESHOLD = 10;
-
- private final String instanceId = UUID.randomUUID().toString();
-
- private final AtomicBoolean healthy = new AtomicBoolean();
-
- private final ScheduledExecutorService executor;
-
- private final StateSynchronizer stateSync;
- private final MembershipListener listener;
- private ScheduledFuture> task;
-
- MembershipSynchronizer(String streamName, ClientFactory manager, ScheduledExecutorService executor,
- MembershipListener listener) {
- Preconditions.checkNotNull(streamName);
- Preconditions.checkNotNull(manager);
- Preconditions.checkNotNull(listener);
- this.executor = executor;
- this.listener = listener;
- stateSync = manager.createStateSynchronizer(streamName,
- new JavaSerializer(),
- new JavaSerializer(),
- null);
- }
-
- @Data
- private static class LiveInstances
- implements Revisioned, Comparable, Serializable, InitialUpdate {
- private final String scopedStreamName;
- private final Revision revision;
- private final Map liveInstances;
- private final long vectorTime;
-
- @Override
- public int compareTo(LiveInstances o) {
- return revision.compareTo(o.revision);
- }
-
- @Override
- public LiveInstances create(String scopedStreamName, Revision revision) {
- return new LiveInstances(scopedStreamName, revision, liveInstances, vectorTime);
- }
-
- public boolean isHealthy(String instance) {
- long unhealthyThreshold = vectorTime - UNHEALTHY_THRESHOLD * liveInstances.size();
- Long time = liveInstances.get(instance);
- return time == null || time >= unhealthyThreshold;
- }
-
- /**
- * If a host is behind in it's heartbeating it does not want to become unhealthy as it might
- * need to halt execution. So it can use unconditional writes to updates itself more quickly
- * by avoiding contention.
- */
- public boolean isOverUnconditionalThreshold(String instance) {
- long updateThreshold = vectorTime - UNCONDITIONAL_UPDATE_THRESHOLD * liveInstances.size();
- Long time = liveInstances.get(instance);
- return time == null || time < updateThreshold;
- }
-
- public List findInstancesThatWillDieBy(long vectorTime) {
- long deathThreshold = vectorTime - DEATH_THRESHOLD * liveInstances.size();
- return liveInstances.entrySet()
- .stream()
- .filter(entry -> entry.getValue() < deathThreshold)
- .map(entry -> entry.getKey())
- .collect(Collectors.toList());
- }
-
- public Set getLiveInstances() {
- return liveInstances.keySet();
- }
- }
-
- private class HeartBeater implements Runnable {
- @Override
- public void run() {
- try {
- stateSync.fetchUpdates();
- notifyListener();
- if (stateSync.getState().isOverUnconditionalThreshold(instanceId)) {
- stateSync.updateState(state -> {
- List result = new ArrayList<>(2);
- long vectorTime = state.getVectorTime() + 1;
- result.add(new HeartBeat(instanceId, vectorTime));
- for (String id : state.findInstancesThatWillDieBy(vectorTime)) {
- if (!id.equals(instanceId)) {
- result.add(new DeclareDead(id));
- }
- }
- return result;
- });
- } else {
- stateSync.updateStateUnconditionally(new HeartBeat(instanceId, stateSync.getState().vectorTime));
- stateSync.fetchUpdates();
- }
- notifyListener();
- } catch (Exception e) {
- log.warn("Encountered an error while heartbeating: " + e);
- if (healthy.compareAndSet(true, false)) {
- listener.unhealthy();
- }
- }
- }
- }
-
- private abstract class HeartbeatUpdate implements Update, Serializable {
- }
-
- @RequiredArgsConstructor
- private final class HeartBeat extends HeartbeatUpdate {
- private final String name;
- private final long timestamp;
-
- @Override
- public LiveInstances applyTo(LiveInstances state, Revision newRevision) {
- Map timestamps = new HashMap<>(state.liveInstances);
- long vectorTime = Long.max(timestamps.values().stream().max(Long::compare).get(), timestamp);
- timestamps.put(name, timestamp);
- return new LiveInstances(state.scopedStreamName,
- newRevision,
- Collections.unmodifiableMap(timestamps),
- vectorTime);
- }
- }
-
- @RequiredArgsConstructor
- private final class DeclareDead extends HeartbeatUpdate {
- private final String name;
-
- @Override
- public LiveInstances applyTo(LiveInstances state, Revision newRevision) {
- Map timestamps = new HashMap<>(state.liveInstances);
- timestamps.remove(name);
- return new LiveInstances(state.scopedStreamName,
- newRevision,
- Collections.unmodifiableMap(timestamps),
- state.vectorTime);
- }
- }
-
- public void notifyListener() {
- LiveInstances currentState = stateSync.getState();
- if (currentState.isHealthy(instanceId)) {
- if (healthy.compareAndSet(false, true)) {
- listener.healthy();
- }
- } else {
- if (healthy.compareAndSet(true, false)) {
- listener.unhealthy();
- }
- }
- }
-
- public boolean isCurrentlyHealthy() {
- return healthy.get();
- }
-
- public Set getCurrentMembers() {
- return stateSync.getState().getLiveInstances();
- }
-
- public interface MembershipListener {
- void healthy();
-
- void unhealthy();
- }
-
- @Override
- protected void doStart() {
- task = executor.scheduleAtFixedRate(new HeartBeater(),
- UPDATE_INTERVAL_MILLIS,
- UPDATE_INTERVAL_MILLIS,
- TimeUnit.MILLISECONDS);
- }
-
- @Override
- protected void doStop() {
- task.cancel(false);
- }
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.emc.pravega.state.examples;
+
+import com.emc.pravega.ClientFactory;
+import com.emc.pravega.state.InitialUpdate;
+import com.emc.pravega.state.Revision;
+import com.emc.pravega.state.Revisioned;
+import com.emc.pravega.state.StateSynchronizer;
+import com.emc.pravega.state.Update;
+import com.emc.pravega.stream.impl.JavaSerializer;
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.AbstractService;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
+
+import lombok.Data;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class MembershipSynchronizer extends AbstractService {
+
+ /**
+ * How frequently to update the segment using a heartbeat.
+ */
+ private static final int UPDATE_INTERVAL_MILLIS = 1000;
+
+ /**
+ * Number of intervals behind before switching to unconditional updates.
+ */
+ private static final int UNCONDITIONAL_UPDATE_THRESHOLD = 3;
+
+ /**
+ * Number of intervals behind before we should stop executing for safety.
+ */
+ private static final int UNHEALTHY_THRESHOLD = 5;
+
+ /**
+ * Number of intervals behind before another host should be considered dead.
+ */
+ private static final int DEATH_THRESHOLD = 10;
+
+ private final String instanceId = UUID.randomUUID().toString();
+
+ private final AtomicBoolean healthy = new AtomicBoolean();
+
+ private final ScheduledExecutorService executor;
+
+ private final StateSynchronizer stateSync;
+ private final MembershipListener listener;
+ private ScheduledFuture> task;
+
+ MembershipSynchronizer(String streamName, ClientFactory manager, ScheduledExecutorService executor,
+ MembershipListener listener) {
+ Preconditions.checkNotNull(streamName);
+ Preconditions.checkNotNull(manager);
+ Preconditions.checkNotNull(listener);
+ this.executor = executor;
+ this.listener = listener;
+ stateSync = manager.createStateSynchronizer(streamName,
+ new JavaSerializer(),
+ new JavaSerializer(),
+ null);
+ }
+
+ @Data
+ private static class LiveInstances
+ implements Revisioned, Comparable, Serializable, InitialUpdate {
+ private final String scopedStreamName;
+ private final Revision revision;
+ private final Map liveInstances;
+ private final long vectorTime;
+
+ @Override
+ public int compareTo(LiveInstances o) {
+ return revision.compareTo(o.revision);
+ }
+
+ @Override
+ public LiveInstances create(String scopedStreamName, Revision revision) {
+ return new LiveInstances(scopedStreamName, revision, liveInstances, vectorTime);
+ }
+
+ public boolean isHealthy(String instance) {
+ long unhealthyThreshold = vectorTime - UNHEALTHY_THRESHOLD * liveInstances.size();
+ Long time = liveInstances.get(instance);
+ return time == null || time >= unhealthyThreshold;
+ }
+
+ /**
+ * If a host is behind in it's heartbeating it does not want to become unhealthy as it might
+ * need to halt execution. So it can use unconditional writes to updates itself more quickly
+ * by avoiding contention.
+ */
+ public boolean isOverUnconditionalThreshold(String instance) {
+ long updateThreshold = vectorTime - UNCONDITIONAL_UPDATE_THRESHOLD * liveInstances.size();
+ Long time = liveInstances.get(instance);
+ return time == null || time < updateThreshold;
+ }
+
+ public List findInstancesThatWillDieBy(long vectorTime) {
+ long deathThreshold = vectorTime - DEATH_THRESHOLD * liveInstances.size();
+ return liveInstances.entrySet()
+ .stream()
+ .filter(entry -> entry.getValue() < deathThreshold)
+ .map(entry -> entry.getKey())
+ .collect(Collectors.toList());
+ }
+
+ public Set getLiveInstances() {
+ return liveInstances.keySet();
+ }
+ }
+
+ private class HeartBeater implements Runnable {
+ @Override
+ public void run() {
+ try {
+ stateSync.fetchUpdates();
+ notifyListener();
+ if (stateSync.getState().isOverUnconditionalThreshold(instanceId)) {
+ stateSync.updateState(state -> {
+ List result = new ArrayList<>(2);
+ long vectorTime = state.getVectorTime() + 1;
+ result.add(new HeartBeat(instanceId, vectorTime));
+ for (String id : state.findInstancesThatWillDieBy(vectorTime)) {
+ if (!id.equals(instanceId)) {
+ result.add(new DeclareDead(id));
+ }
+ }
+ return result;
+ });
+ } else {
+ stateSync.updateStateUnconditionally(new HeartBeat(instanceId, stateSync.getState().vectorTime));
+ stateSync.fetchUpdates();
+ }
+ notifyListener();
+ } catch (Exception e) {
+ log.warn("Encountered an error while heartbeating: " + e);
+ if (healthy.compareAndSet(true, false)) {
+ listener.unhealthy();
+ }
+ }
+ }
+ }
+
+ private abstract class HeartbeatUpdate implements Update, Serializable {
+ }
+
+ @RequiredArgsConstructor
+ private final class HeartBeat extends HeartbeatUpdate {
+ private final String name;
+ private final long timestamp;
+
+ @Override
+ public LiveInstances applyTo(LiveInstances state, Revision newRevision) {
+ Map timestamps = new HashMap<>(state.liveInstances);
+ long vectorTime = Long.max(timestamps.values().stream().max(Long::compare).get(), timestamp);
+ timestamps.put(name, timestamp);
+ return new LiveInstances(state.scopedStreamName,
+ newRevision,
+ Collections.unmodifiableMap(timestamps),
+ vectorTime);
+ }
+ }
+
+ @RequiredArgsConstructor
+ private final class DeclareDead extends HeartbeatUpdate {
+ private final String name;
+
+ @Override
+ public LiveInstances applyTo(LiveInstances state, Revision newRevision) {
+ Map timestamps = new HashMap<>(state.liveInstances);
+ timestamps.remove(name);
+ return new LiveInstances(state.scopedStreamName,
+ newRevision,
+ Collections.unmodifiableMap(timestamps),
+ state.vectorTime);
+ }
+ }
+
+ public void notifyListener() {
+ LiveInstances currentState = stateSync.getState();
+ if (currentState.isHealthy(instanceId)) {
+ if (healthy.compareAndSet(false, true)) {
+ listener.healthy();
+ }
+ } else {
+ if (healthy.compareAndSet(true, false)) {
+ listener.unhealthy();
+ }
+ }
+ }
+
+ public boolean isCurrentlyHealthy() {
+ return healthy.get();
+ }
+
+ public Set getCurrentMembers() {
+ return stateSync.getState().getLiveInstances();
+ }
+
+ public interface MembershipListener {
+ void healthy();
+
+ void unhealthy();
+ }
+
+ @Override
+ protected void doStart() {
+ task = executor.scheduleAtFixedRate(new HeartBeater(),
+ UPDATE_INTERVAL_MILLIS,
+ UPDATE_INTERVAL_MILLIS,
+ TimeUnit.MILLISECONDS);
+ }
+
+ @Override
+ protected void doStop() {
+ task.cancel(false);
+ }
+
+}
diff --git a/controller/contract/src/generated/gen-java/com/emc/pravega/controller/stream/api/v1/ControllerService.java b/controller/contract/src/generated/gen-java/com/emc/pravega/controller/stream/api/v1/ControllerService.java
index e126ef3d4fb..a665c72bf8c 100644
--- a/controller/contract/src/generated/gen-java/com/emc/pravega/controller/stream/api/v1/ControllerService.java
+++ b/controller/contract/src/generated/gen-java/com/emc/pravega/controller/stream/api/v1/ControllerService.java
@@ -1,13603 +1,13603 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.3)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package com.emc.pravega.controller.stream.api.v1;
-
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import javax.annotation.Generated;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-01-28")
-public class ControllerService {
-
- public interface Iface {
-
- public CreateStreamStatus createStream(StreamConfig streamConfig) throws org.apache.thrift.TException;
-
- public UpdateStreamStatus alterStream(StreamConfig streamConfig) throws org.apache.thrift.TException;
-
- public UpdateStreamStatus sealStream(String scope, String stream) throws org.apache.thrift.TException;
-
- public List getCurrentSegments(String scope, String stream) throws org.apache.thrift.TException;
-
- public List getPositions(String scope, String stream, long timestamp, int count) throws org.apache.thrift.TException;
-
- public Map> getSegmentsImmediatlyFollowing(SegmentId segment) throws org.apache.thrift.TException;
-
- public ScaleResponse scale(String scope, String stream, List sealedSegments, Map newKeyRanges, long scaleTimestamp) throws org.apache.thrift.TException;
-
- public NodeUri getURI(SegmentId segment) throws org.apache.thrift.TException;
-
- public boolean isSegmentValid(String scope, String stream, int segmentNumber) throws org.apache.thrift.TException;
-
- public TxnId createTransaction(String scope, String stream) throws org.apache.thrift.TException;
-
- public TxnStatus commitTransaction(String scope, String stream, TxnId txnid) throws org.apache.thrift.TException;
-
- public TxnStatus abortTransaction(String scope, String stream, TxnId txnid) throws org.apache.thrift.TException;
-
- public TxnState checkTransactionStatus(String scope, String stream, TxnId txnid) throws org.apache.thrift.TException;
-
- }
-
- public interface AsyncIface {
-
- public void createStream(StreamConfig streamConfig, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void alterStream(StreamConfig streamConfig, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void sealStream(String scope, String stream, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void getCurrentSegments(String scope, String stream, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void getPositions(String scope, String stream, long timestamp, int count, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void getSegmentsImmediatlyFollowing(SegmentId segment, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void scale(String scope, String stream, List sealedSegments, Map newKeyRanges, long scaleTimestamp, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void getURI(SegmentId segment, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void isSegmentValid(String scope, String stream, int segmentNumber, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void createTransaction(String scope, String stream, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void commitTransaction(String scope, String stream, TxnId txnid, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void abortTransaction(String scope, String stream, TxnId txnid, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void checkTransactionStatus(String scope, String stream, TxnId txnid, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- }
-
- public static class Client extends org.apache.thrift.TServiceClient implements Iface {
- public static class Factory implements org.apache.thrift.TServiceClientFactory {
- public Factory() {}
- public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
- return new Client(prot);
- }
- public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
- return new Client(iprot, oprot);
- }
- }
-
- public Client(org.apache.thrift.protocol.TProtocol prot)
- {
- super(prot, prot);
- }
-
- public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
- super(iprot, oprot);
- }
-
- public CreateStreamStatus createStream(StreamConfig streamConfig) throws org.apache.thrift.TException
- {
- send_createStream(streamConfig);
- return recv_createStream();
- }
-
- public void send_createStream(StreamConfig streamConfig) throws org.apache.thrift.TException
- {
- createStream_args args = new createStream_args();
- args.setStreamConfig(streamConfig);
- sendBase("createStream", args);
- }
-
- public CreateStreamStatus recv_createStream() throws org.apache.thrift.TException
- {
- createStream_result result = new createStream_result();
- receiveBase(result, "createStream");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "createStream failed: unknown result");
- }
-
- public UpdateStreamStatus alterStream(StreamConfig streamConfig) throws org.apache.thrift.TException
- {
- send_alterStream(streamConfig);
- return recv_alterStream();
- }
-
- public void send_alterStream(StreamConfig streamConfig) throws org.apache.thrift.TException
- {
- alterStream_args args = new alterStream_args();
- args.setStreamConfig(streamConfig);
- sendBase("alterStream", args);
- }
-
- public UpdateStreamStatus recv_alterStream() throws org.apache.thrift.TException
- {
- alterStream_result result = new alterStream_result();
- receiveBase(result, "alterStream");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alterStream failed: unknown result");
- }
-
- public UpdateStreamStatus sealStream(String scope, String stream) throws org.apache.thrift.TException
- {
- send_sealStream(scope, stream);
- return recv_sealStream();
- }
-
- public void send_sealStream(String scope, String stream) throws org.apache.thrift.TException
- {
- sealStream_args args = new sealStream_args();
- args.setScope(scope);
- args.setStream(stream);
- sendBase("sealStream", args);
- }
-
- public UpdateStreamStatus recv_sealStream() throws org.apache.thrift.TException
- {
- sealStream_result result = new sealStream_result();
- receiveBase(result, "sealStream");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "sealStream failed: unknown result");
- }
-
- public List getCurrentSegments(String scope, String stream) throws org.apache.thrift.TException
- {
- send_getCurrentSegments(scope, stream);
- return recv_getCurrentSegments();
- }
-
- public void send_getCurrentSegments(String scope, String stream) throws org.apache.thrift.TException
- {
- getCurrentSegments_args args = new getCurrentSegments_args();
- args.setScope(scope);
- args.setStream(stream);
- sendBase("getCurrentSegments", args);
- }
-
- public List recv_getCurrentSegments() throws org.apache.thrift.TException
- {
- getCurrentSegments_result result = new getCurrentSegments_result();
- receiveBase(result, "getCurrentSegments");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getCurrentSegments failed: unknown result");
- }
-
- public List getPositions(String scope, String stream, long timestamp, int count) throws org.apache.thrift.TException
- {
- send_getPositions(scope, stream, timestamp, count);
- return recv_getPositions();
- }
-
- public void send_getPositions(String scope, String stream, long timestamp, int count) throws org.apache.thrift.TException
- {
- getPositions_args args = new getPositions_args();
- args.setScope(scope);
- args.setStream(stream);
- args.setTimestamp(timestamp);
- args.setCount(count);
- sendBase("getPositions", args);
- }
-
- public List recv_getPositions() throws org.apache.thrift.TException
- {
- getPositions_result result = new getPositions_result();
- receiveBase(result, "getPositions");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPositions failed: unknown result");
- }
-
- public Map> getSegmentsImmediatlyFollowing(SegmentId segment) throws org.apache.thrift.TException
- {
- send_getSegmentsImmediatlyFollowing(segment);
- return recv_getSegmentsImmediatlyFollowing();
- }
-
- public void send_getSegmentsImmediatlyFollowing(SegmentId segment) throws org.apache.thrift.TException
- {
- getSegmentsImmediatlyFollowing_args args = new getSegmentsImmediatlyFollowing_args();
- args.setSegment(segment);
- sendBase("getSegmentsImmediatlyFollowing", args);
- }
-
- public Map> recv_getSegmentsImmediatlyFollowing() throws org.apache.thrift.TException
- {
- getSegmentsImmediatlyFollowing_result result = new getSegmentsImmediatlyFollowing_result();
- receiveBase(result, "getSegmentsImmediatlyFollowing");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getSegmentsImmediatlyFollowing failed: unknown result");
- }
-
- public ScaleResponse scale(String scope, String stream, List sealedSegments, Map newKeyRanges, long scaleTimestamp) throws org.apache.thrift.TException
- {
- send_scale(scope, stream, sealedSegments, newKeyRanges, scaleTimestamp);
- return recv_scale();
- }
-
- public void send_scale(String scope, String stream, List sealedSegments, Map newKeyRanges, long scaleTimestamp) throws org.apache.thrift.TException
- {
- scale_args args = new scale_args();
- args.setScope(scope);
- args.setStream(stream);
- args.setSealedSegments(sealedSegments);
- args.setNewKeyRanges(newKeyRanges);
- args.setScaleTimestamp(scaleTimestamp);
- sendBase("scale", args);
- }
-
- public ScaleResponse recv_scale() throws org.apache.thrift.TException
- {
- scale_result result = new scale_result();
- receiveBase(result, "scale");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "scale failed: unknown result");
- }
-
- public NodeUri getURI(SegmentId segment) throws org.apache.thrift.TException
- {
- send_getURI(segment);
- return recv_getURI();
- }
-
- public void send_getURI(SegmentId segment) throws org.apache.thrift.TException
- {
- getURI_args args = new getURI_args();
- args.setSegment(segment);
- sendBase("getURI", args);
- }
-
- public NodeUri recv_getURI() throws org.apache.thrift.TException
- {
- getURI_result result = new getURI_result();
- receiveBase(result, "getURI");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getURI failed: unknown result");
- }
-
- public boolean isSegmentValid(String scope, String stream, int segmentNumber) throws org.apache.thrift.TException
- {
- send_isSegmentValid(scope, stream, segmentNumber);
- return recv_isSegmentValid();
- }
-
- public void send_isSegmentValid(String scope, String stream, int segmentNumber) throws org.apache.thrift.TException
- {
- isSegmentValid_args args = new isSegmentValid_args();
- args.setScope(scope);
- args.setStream(stream);
- args.setSegmentNumber(segmentNumber);
- sendBase("isSegmentValid", args);
- }
-
- public boolean recv_isSegmentValid() throws org.apache.thrift.TException
- {
- isSegmentValid_result result = new isSegmentValid_result();
- receiveBase(result, "isSegmentValid");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "isSegmentValid failed: unknown result");
- }
-
- public TxnId createTransaction(String scope, String stream) throws org.apache.thrift.TException
- {
- send_createTransaction(scope, stream);
- return recv_createTransaction();
- }
-
- public void send_createTransaction(String scope, String stream) throws org.apache.thrift.TException
- {
- createTransaction_args args = new createTransaction_args();
- args.setScope(scope);
- args.setStream(stream);
- sendBase("createTransaction", args);
- }
-
- public TxnId recv_createTransaction() throws org.apache.thrift.TException
- {
- createTransaction_result result = new createTransaction_result();
- receiveBase(result, "createTransaction");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "createTransaction failed: unknown result");
- }
-
- public TxnStatus commitTransaction(String scope, String stream, TxnId txnid) throws org.apache.thrift.TException
- {
- send_commitTransaction(scope, stream, txnid);
- return recv_commitTransaction();
- }
-
- public void send_commitTransaction(String scope, String stream, TxnId txnid) throws org.apache.thrift.TException
- {
- commitTransaction_args args = new commitTransaction_args();
- args.setScope(scope);
- args.setStream(stream);
- args.setTxnid(txnid);
- sendBase("commitTransaction", args);
- }
-
- public TxnStatus recv_commitTransaction() throws org.apache.thrift.TException
- {
- commitTransaction_result result = new commitTransaction_result();
- receiveBase(result, "commitTransaction");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "commitTransaction failed: unknown result");
- }
-
- public TxnStatus abortTransaction(String scope, String stream, TxnId txnid) throws org.apache.thrift.TException
- {
- send_abortTransaction(scope, stream, txnid);
- return recv_abortTransaction();
- }
-
- public void send_abortTransaction(String scope, String stream, TxnId txnid) throws org.apache.thrift.TException
- {
- abortTransaction_args args = new abortTransaction_args();
- args.setScope(scope);
- args.setStream(stream);
- args.setTxnid(txnid);
- sendBase("abortTransaction", args);
- }
-
- public TxnStatus recv_abortTransaction() throws org.apache.thrift.TException
- {
- abortTransaction_result result = new abortTransaction_result();
- receiveBase(result, "abortTransaction");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "abortTransaction failed: unknown result");
- }
-
- public TxnState checkTransactionStatus(String scope, String stream, TxnId txnid) throws org.apache.thrift.TException
- {
- send_checkTransactionStatus(scope, stream, txnid);
- return recv_checkTransactionStatus();
- }
-
- public void send_checkTransactionStatus(String scope, String stream, TxnId txnid) throws org.apache.thrift.TException
- {
- checkTransactionStatus_args args = new checkTransactionStatus_args();
- args.setScope(scope);
- args.setStream(stream);
- args.setTxnid(txnid);
- sendBase("checkTransactionStatus", args);
- }
-
- public TxnState recv_checkTransactionStatus() throws org.apache.thrift.TException
- {
- checkTransactionStatus_result result = new checkTransactionStatus_result();
- receiveBase(result, "checkTransactionStatus");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "checkTransactionStatus failed: unknown result");
- }
-
- }
- public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
- public static class Factory implements org.apache.thrift.async.TAsyncClientFactory {
- private org.apache.thrift.async.TAsyncClientManager clientManager;
- private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
- public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
- this.clientManager = clientManager;
- this.protocolFactory = protocolFactory;
- }
- public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
- return new AsyncClient(protocolFactory, clientManager, transport);
- }
- }
-
- public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
- super(protocolFactory, clientManager, transport);
- }
-
- public void createStream(StreamConfig streamConfig, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- createStream_call method_call = new createStream_call(streamConfig, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class createStream_call extends org.apache.thrift.async.TAsyncMethodCall {
- private StreamConfig streamConfig;
- public createStream_call(StreamConfig streamConfig, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.streamConfig = streamConfig;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("createStream", org.apache.thrift.protocol.TMessageType.CALL, 0));
- createStream_args args = new createStream_args();
- args.setStreamConfig(streamConfig);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public CreateStreamStatus getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_createStream();
- }
- }
-
- public void alterStream(StreamConfig streamConfig, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alterStream_call method_call = new alterStream_call(streamConfig, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alterStream_call extends org.apache.thrift.async.TAsyncMethodCall {
- private StreamConfig streamConfig;
- public alterStream_call(StreamConfig streamConfig, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.streamConfig = streamConfig;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("alterStream", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alterStream_args args = new alterStream_args();
- args.setStreamConfig(streamConfig);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public UpdateStreamStatus getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_alterStream();
- }
- }
-
- public void sealStream(String scope, String stream, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- sealStream_call method_call = new sealStream_call(scope, stream, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class sealStream_call extends org.apache.thrift.async.TAsyncMethodCall {
- private String scope;
- private String stream;
- public sealStream_call(String scope, String stream, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.scope = scope;
- this.stream = stream;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("sealStream", org.apache.thrift.protocol.TMessageType.CALL, 0));
- sealStream_args args = new sealStream_args();
- args.setScope(scope);
- args.setStream(stream);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public UpdateStreamStatus getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_sealStream();
- }
- }
-
- public void getCurrentSegments(String scope, String stream, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- getCurrentSegments_call method_call = new getCurrentSegments_call(scope, stream, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class getCurrentSegments_call extends org.apache.thrift.async.TAsyncMethodCall {
- private String scope;
- private String stream;
- public getCurrentSegments_call(String scope, String stream, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.scope = scope;
- this.stream = stream;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getCurrentSegments", org.apache.thrift.protocol.TMessageType.CALL, 0));
- getCurrentSegments_args args = new getCurrentSegments_args();
- args.setScope(scope);
- args.setStream(stream);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public List getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_getCurrentSegments();
- }
- }
-
- public void getPositions(String scope, String stream, long timestamp, int count, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- getPositions_call method_call = new getPositions_call(scope, stream, timestamp, count, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class getPositions_call extends org.apache.thrift.async.TAsyncMethodCall {
- private String scope;
- private String stream;
- private long timestamp;
- private int count;
- public getPositions_call(String scope, String stream, long timestamp, int count, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.scope = scope;
- this.stream = stream;
- this.timestamp = timestamp;
- this.count = count;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getPositions", org.apache.thrift.protocol.TMessageType.CALL, 0));
- getPositions_args args = new getPositions_args();
- args.setScope(scope);
- args.setStream(stream);
- args.setTimestamp(timestamp);
- args.setCount(count);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public List getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_getPositions();
- }
- }
-
- public void getSegmentsImmediatlyFollowing(SegmentId segment, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- getSegmentsImmediatlyFollowing_call method_call = new getSegmentsImmediatlyFollowing_call(segment, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class getSegmentsImmediatlyFollowing_call extends org.apache.thrift.async.TAsyncMethodCall {
- private SegmentId segment;
- public getSegmentsImmediatlyFollowing_call(SegmentId segment, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.segment = segment;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getSegmentsImmediatlyFollowing", org.apache.thrift.protocol.TMessageType.CALL, 0));
- getSegmentsImmediatlyFollowing_args args = new getSegmentsImmediatlyFollowing_args();
- args.setSegment(segment);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public Map> getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_getSegmentsImmediatlyFollowing();
- }
- }
-
- public void scale(String scope, String stream, List sealedSegments, Map newKeyRanges, long scaleTimestamp, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- scale_call method_call = new scale_call(scope, stream, sealedSegments, newKeyRanges, scaleTimestamp, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class scale_call extends org.apache.thrift.async.TAsyncMethodCall {
- private String scope;
- private String stream;
- private List sealedSegments;
- private Map newKeyRanges;
- private long scaleTimestamp;
- public scale_call(String scope, String stream, List sealedSegments, Map newKeyRanges, long scaleTimestamp, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.scope = scope;
- this.stream = stream;
- this.sealedSegments = sealedSegments;
- this.newKeyRanges = newKeyRanges;
- this.scaleTimestamp = scaleTimestamp;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("scale", org.apache.thrift.protocol.TMessageType.CALL, 0));
- scale_args args = new scale_args();
- args.setScope(scope);
- args.setStream(stream);
- args.setSealedSegments(sealedSegments);
- args.setNewKeyRanges(newKeyRanges);
- args.setScaleTimestamp(scaleTimestamp);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public ScaleResponse getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_scale();
- }
- }
-
- public void getURI(SegmentId segment, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- getURI_call method_call = new getURI_call(segment, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class getURI_call extends org.apache.thrift.async.TAsyncMethodCall {
- private SegmentId segment;
- public getURI_call(SegmentId segment, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.segment = segment;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getURI", org.apache.thrift.protocol.TMessageType.CALL, 0));
- getURI_args args = new getURI_args();
- args.setSegment(segment);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public NodeUri getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_getURI();
- }
- }
-
- public void isSegmentValid(String scope, String stream, int segmentNumber, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- isSegmentValid_call method_call = new isSegmentValid_call(scope, stream, segmentNumber, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class isSegmentValid_call extends org.apache.thrift.async.TAsyncMethodCall {
- private String scope;
- private String stream;
- private int segmentNumber;
- public isSegmentValid_call(String scope, String stream, int segmentNumber, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.scope = scope;
- this.stream = stream;
- this.segmentNumber = segmentNumber;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("isSegmentValid", org.apache.thrift.protocol.TMessageType.CALL, 0));
- isSegmentValid_args args = new isSegmentValid_args();
- args.setScope(scope);
- args.setStream(stream);
- args.setSegmentNumber(segmentNumber);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public boolean getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_isSegmentValid();
- }
- }
-
- public void createTransaction(String scope, String stream, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- createTransaction_call method_call = new createTransaction_call(scope, stream, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class createTransaction_call extends org.apache.thrift.async.TAsyncMethodCall {
- private String scope;
- private String stream;
- public createTransaction_call(String scope, String stream, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.scope = scope;
- this.stream = stream;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("createTransaction", org.apache.thrift.protocol.TMessageType.CALL, 0));
- createTransaction_args args = new createTransaction_args();
- args.setScope(scope);
- args.setStream(stream);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TxnId getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_createTransaction();
- }
- }
-
- public void commitTransaction(String scope, String stream, TxnId txnid, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- commitTransaction_call method_call = new commitTransaction_call(scope, stream, txnid, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class commitTransaction_call extends org.apache.thrift.async.TAsyncMethodCall {
- private String scope;
- private String stream;
- private TxnId txnid;
- public commitTransaction_call(String scope, String stream, TxnId txnid, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.scope = scope;
- this.stream = stream;
- this.txnid = txnid;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("commitTransaction", org.apache.thrift.protocol.TMessageType.CALL, 0));
- commitTransaction_args args = new commitTransaction_args();
- args.setScope(scope);
- args.setStream(stream);
- args.setTxnid(txnid);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TxnStatus getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_commitTransaction();
- }
- }
-
- public void abortTransaction(String scope, String stream, TxnId txnid, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- abortTransaction_call method_call = new abortTransaction_call(scope, stream, txnid, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class abortTransaction_call extends org.apache.thrift.async.TAsyncMethodCall {
- private String scope;
- private String stream;
- private TxnId txnid;
- public abortTransaction_call(String scope, String stream, TxnId txnid, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.scope = scope;
- this.stream = stream;
- this.txnid = txnid;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("abortTransaction", org.apache.thrift.protocol.TMessageType.CALL, 0));
- abortTransaction_args args = new abortTransaction_args();
- args.setScope(scope);
- args.setStream(stream);
- args.setTxnid(txnid);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TxnStatus getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_abortTransaction();
- }
- }
-
- public void checkTransactionStatus(String scope, String stream, TxnId txnid, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- checkTransactionStatus_call method_call = new checkTransactionStatus_call(scope, stream, txnid, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class checkTransactionStatus_call extends org.apache.thrift.async.TAsyncMethodCall {
- private String scope;
- private String stream;
- private TxnId txnid;
- public checkTransactionStatus_call(String scope, String stream, TxnId txnid, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.scope = scope;
- this.stream = stream;
- this.txnid = txnid;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("checkTransactionStatus", org.apache.thrift.protocol.TMessageType.CALL, 0));
- checkTransactionStatus_args args = new checkTransactionStatus_args();
- args.setScope(scope);
- args.setStream(stream);
- args.setTxnid(txnid);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TxnState getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_checkTransactionStatus();
- }
- }
-
- }
-
- public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor {
- private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
- public Processor(I iface) {
- super(iface, getProcessMap(new HashMap>()));
- }
-
- protected Processor(I iface, Map> processMap) {
- super(iface, getProcessMap(processMap));
- }
-
- private static Map> getProcessMap(Map> processMap) {
- processMap.put("createStream", new createStream());
- processMap.put("alterStream", new alterStream());
- processMap.put("sealStream", new sealStream());
- processMap.put("getCurrentSegments", new getCurrentSegments());
- processMap.put("getPositions", new getPositions());
- processMap.put("getSegmentsImmediatlyFollowing", new getSegmentsImmediatlyFollowing());
- processMap.put("scale", new scale());
- processMap.put("getURI", new getURI());
- processMap.put("isSegmentValid", new isSegmentValid());
- processMap.put("createTransaction", new createTransaction());
- processMap.put("commitTransaction", new commitTransaction());
- processMap.put("abortTransaction", new abortTransaction());
- processMap.put("checkTransactionStatus", new checkTransactionStatus());
- return processMap;
- }
-
- public static class createStream extends org.apache.thrift.ProcessFunction {
- public createStream() {
- super("createStream");
- }
-
- public createStream_args getEmptyArgsInstance() {
- return new createStream_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public createStream_result getResult(I iface, createStream_args args) throws org.apache.thrift.TException {
- createStream_result result = new createStream_result();
- result.success = iface.createStream(args.streamConfig);
- return result;
- }
- }
-
- public static class alterStream extends org.apache.thrift.ProcessFunction {
- public alterStream() {
- super("alterStream");
- }
-
- public alterStream_args getEmptyArgsInstance() {
- return new alterStream_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alterStream_result getResult(I iface, alterStream_args args) throws org.apache.thrift.TException {
- alterStream_result result = new alterStream_result();
- result.success = iface.alterStream(args.streamConfig);
- return result;
- }
- }
-
- public static class sealStream extends org.apache.thrift.ProcessFunction {
- public sealStream() {
- super("sealStream");
- }
-
- public sealStream_args getEmptyArgsInstance() {
- return new sealStream_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public sealStream_result getResult(I iface, sealStream_args args) throws org.apache.thrift.TException {
- sealStream_result result = new sealStream_result();
- result.success = iface.sealStream(args.scope, args.stream);
- return result;
- }
- }
-
- public static class getCurrentSegments extends org.apache.thrift.ProcessFunction {
- public getCurrentSegments() {
- super("getCurrentSegments");
- }
-
- public getCurrentSegments_args getEmptyArgsInstance() {
- return new getCurrentSegments_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public getCurrentSegments_result getResult(I iface, getCurrentSegments_args args) throws org.apache.thrift.TException {
- getCurrentSegments_result result = new getCurrentSegments_result();
- result.success = iface.getCurrentSegments(args.scope, args.stream);
- return result;
- }
- }
-
- public static class getPositions extends org.apache.thrift.ProcessFunction {
- public getPositions() {
- super("getPositions");
- }
-
- public getPositions_args getEmptyArgsInstance() {
- return new getPositions_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public getPositions_result getResult(I iface, getPositions_args args) throws org.apache.thrift.TException {
- getPositions_result result = new getPositions_result();
- result.success = iface.getPositions(args.scope, args.stream, args.timestamp, args.count);
- return result;
- }
- }
-
- public static class getSegmentsImmediatlyFollowing extends org.apache.thrift.ProcessFunction {
- public getSegmentsImmediatlyFollowing() {
- super("getSegmentsImmediatlyFollowing");
- }
-
- public getSegmentsImmediatlyFollowing_args getEmptyArgsInstance() {
- return new getSegmentsImmediatlyFollowing_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public getSegmentsImmediatlyFollowing_result getResult(I iface, getSegmentsImmediatlyFollowing_args args) throws org.apache.thrift.TException {
- getSegmentsImmediatlyFollowing_result result = new getSegmentsImmediatlyFollowing_result();
- result.success = iface.getSegmentsImmediatlyFollowing(args.segment);
- return result;
- }
- }
-
- public static class scale extends org.apache.thrift.ProcessFunction {
- public scale() {
- super("scale");
- }
-
- public scale_args getEmptyArgsInstance() {
- return new scale_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public scale_result getResult(I iface, scale_args args) throws org.apache.thrift.TException {
- scale_result result = new scale_result();
- result.success = iface.scale(args.scope, args.stream, args.sealedSegments, args.newKeyRanges, args.scaleTimestamp);
- return result;
- }
- }
-
- public static class getURI extends org.apache.thrift.ProcessFunction {
- public getURI() {
- super("getURI");
- }
-
- public getURI_args getEmptyArgsInstance() {
- return new getURI_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public getURI_result getResult(I iface, getURI_args args) throws org.apache.thrift.TException {
- getURI_result result = new getURI_result();
- result.success = iface.getURI(args.segment);
- return result;
- }
- }
-
- public static class isSegmentValid extends org.apache.thrift.ProcessFunction {
- public isSegmentValid() {
- super("isSegmentValid");
- }
-
- public isSegmentValid_args getEmptyArgsInstance() {
- return new isSegmentValid_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public isSegmentValid_result getResult(I iface, isSegmentValid_args args) throws org.apache.thrift.TException {
- isSegmentValid_result result = new isSegmentValid_result();
- result.success = iface.isSegmentValid(args.scope, args.stream, args.segmentNumber);
- result.setSuccessIsSet(true);
- return result;
- }
- }
-
- public static class createTransaction extends org.apache.thrift.ProcessFunction {
- public createTransaction() {
- super("createTransaction");
- }
-
- public createTransaction_args getEmptyArgsInstance() {
- return new createTransaction_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public createTransaction_result getResult(I iface, createTransaction_args args) throws org.apache.thrift.TException {
- createTransaction_result result = new createTransaction_result();
- result.success = iface.createTransaction(args.scope, args.stream);
- return result;
- }
- }
-
- public static class commitTransaction extends org.apache.thrift.ProcessFunction {
- public commitTransaction() {
- super("commitTransaction");
- }
-
- public commitTransaction_args getEmptyArgsInstance() {
- return new commitTransaction_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public commitTransaction_result getResult(I iface, commitTransaction_args args) throws org.apache.thrift.TException {
- commitTransaction_result result = new commitTransaction_result();
- result.success = iface.commitTransaction(args.scope, args.stream, args.txnid);
- return result;
- }
- }
-
- public static class abortTransaction extends org.apache.thrift.ProcessFunction {
- public abortTransaction() {
- super("abortTransaction");
- }
-
- public abortTransaction_args getEmptyArgsInstance() {
- return new abortTransaction_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public abortTransaction_result getResult(I iface, abortTransaction_args args) throws org.apache.thrift.TException {
- abortTransaction_result result = new abortTransaction_result();
- result.success = iface.abortTransaction(args.scope, args.stream, args.txnid);
- return result;
- }
- }
-
- public static class checkTransactionStatus extends org.apache.thrift.ProcessFunction {
- public checkTransactionStatus() {
- super("checkTransactionStatus");
- }
-
- public checkTransactionStatus_args getEmptyArgsInstance() {
- return new checkTransactionStatus_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public checkTransactionStatus_result getResult(I iface, checkTransactionStatus_args args) throws org.apache.thrift.TException {
- checkTransactionStatus_result result = new checkTransactionStatus_result();
- result.success = iface.checkTransactionStatus(args.scope, args.stream, args.txnid);
- return result;
- }
- }
-
- }
-
- public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor {
- private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
- public AsyncProcessor(I iface) {
- super(iface, getProcessMap(new HashMap>()));
- }
-
- protected AsyncProcessor(I iface, Map> processMap) {
- super(iface, getProcessMap(processMap));
- }
-
- private static Map> getProcessMap(Map> processMap) {
- processMap.put("createStream", new createStream());
- processMap.put("alterStream", new alterStream());
- processMap.put("sealStream", new sealStream());
- processMap.put("getCurrentSegments", new getCurrentSegments());
- processMap.put("getPositions", new getPositions());
- processMap.put("getSegmentsImmediatlyFollowing", new getSegmentsImmediatlyFollowing());
- processMap.put("scale", new scale());
- processMap.put("getURI", new getURI());
- processMap.put("isSegmentValid", new isSegmentValid());
- processMap.put("createTransaction", new createTransaction());
- processMap.put("commitTransaction", new commitTransaction());
- processMap.put("abortTransaction", new abortTransaction());
- processMap.put("checkTransactionStatus", new checkTransactionStatus());
- return processMap;
- }
-
- public static class createStream extends org.apache.thrift.AsyncProcessFunction {
- public createStream() {
- super("createStream");
- }
-
- public createStream_args getEmptyArgsInstance() {
- return new createStream_args();
- }
-
- public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback() {
- public void onComplete(CreateStreamStatus o) {
- createStream_result result = new createStream_result();
- result.success = o;
- try {
- fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- return;
- } catch (Exception e) {
- LOGGER.error("Exception writing to internal frame buffer", e);
- }
- fb.close();
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TBase msg;
- createStream_result result = new createStream_result();
- {
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- return;
- } catch (Exception ex) {
- LOGGER.error("Exception writing to internal frame buffer", ex);
- }
- fb.close();
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, createStream_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
- iface.createStream(args.streamConfig,resultHandler);
- }
- }
-
- public static class alterStream extends org.apache.thrift.AsyncProcessFunction {
- public alterStream() {
- super("alterStream");
- }
-
- public alterStream_args getEmptyArgsInstance() {
- return new alterStream_args();
- }
-
- public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback() {
- public void onComplete(UpdateStreamStatus o) {
- alterStream_result result = new alterStream_result();
- result.success = o;
- try {
- fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- return;
- } catch (Exception e) {
- LOGGER.error("Exception writing to internal frame buffer", e);
- }
- fb.close();
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TBase msg;
- alterStream_result result = new alterStream_result();
- {
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- return;
- } catch (Exception ex) {
- LOGGER.error("Exception writing to internal frame buffer", ex);
- }
- fb.close();
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, alterStream_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
- iface.alterStream(args.streamConfig,resultHandler);
- }
- }
-
- public static class sealStream extends org.apache.thrift.AsyncProcessFunction {
- public sealStream() {
- super("sealStream");
- }
-
- public sealStream_args getEmptyArgsInstance() {
- return new sealStream_args();
- }
-
- public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback() {
- public void onComplete(UpdateStreamStatus o) {
- sealStream_result result = new sealStream_result();
- result.success = o;
- try {
- fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- return;
- } catch (Exception e) {
- LOGGER.error("Exception writing to internal frame buffer", e);
- }
- fb.close();
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TBase msg;
- sealStream_result result = new sealStream_result();
- {
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- return;
- } catch (Exception ex) {
- LOGGER.error("Exception writing to internal frame buffer", ex);
- }
- fb.close();
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, sealStream_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
- iface.sealStream(args.scope, args.stream,resultHandler);
- }
- }
-
- public static class getCurrentSegments extends org.apache.thrift.AsyncProcessFunction> {
- public getCurrentSegments() {
- super("getCurrentSegments");
- }
-
- public getCurrentSegments_args getEmptyArgsInstance() {
- return new getCurrentSegments_args();
- }
-
- public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback>() {
- public void onComplete(List o) {
- getCurrentSegments_result result = new getCurrentSegments_result();
- result.success = o;
- try {
- fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- return;
- } catch (Exception e) {
- LOGGER.error("Exception writing to internal frame buffer", e);
- }
- fb.close();
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TBase msg;
- getCurrentSegments_result result = new getCurrentSegments_result();
- {
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- return;
- } catch (Exception ex) {
- LOGGER.error("Exception writing to internal frame buffer", ex);
- }
- fb.close();
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, getCurrentSegments_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException {
- iface.getCurrentSegments(args.scope, args.stream,resultHandler);
- }
- }
-
- public static class getPositions extends org.apache.thrift.AsyncProcessFunction> {
- public getPositions() {
- super("getPositions");
- }
-
- public getPositions_args getEmptyArgsInstance() {
- return new getPositions_args();
- }
-
- public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback>() {
- public void onComplete(List o) {
- getPositions_result result = new getPositions_result();
- result.success = o;
- try {
- fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- return;
- } catch (Exception e) {
- LOGGER.error("Exception writing to internal frame buffer", e);
- }
- fb.close();
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TBase msg;
- getPositions_result result = new getPositions_result();
- {
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- return;
- } catch (Exception ex) {
- LOGGER.error("Exception writing to internal frame buffer", ex);
- }
- fb.close();
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, getPositions_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException {
- iface.getPositions(args.scope, args.stream, args.timestamp, args.count,resultHandler);
- }
- }
-
- public static class getSegmentsImmediatlyFollowing extends org.apache.thrift.AsyncProcessFunction>> {
- public getSegmentsImmediatlyFollowing() {
- super("getSegmentsImmediatlyFollowing");
- }
-
- public getSegmentsImmediatlyFollowing_args getEmptyArgsInstance() {
- return new getSegmentsImmediatlyFollowing_args();
- }
-
- public AsyncMethodCallback>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback>>() {
- public void onComplete(Map> o) {
- getSegmentsImmediatlyFollowing_result result = new getSegmentsImmediatlyFollowing_result();
- result.success = o;
- try {
- fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- return;
- } catch (Exception e) {
- LOGGER.error("Exception writing to internal frame buffer", e);
- }
- fb.close();
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TBase msg;
- getSegmentsImmediatlyFollowing_result result = new getSegmentsImmediatlyFollowing_result();
- {
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- return;
- } catch (Exception ex) {
- LOGGER.error("Exception writing to internal frame buffer", ex);
- }
- fb.close();
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, getSegmentsImmediatlyFollowing_args args, org.apache.thrift.async.AsyncMethodCallback>> resultHandler) throws TException {
- iface.getSegmentsImmediatlyFollowing(args.segment,resultHandler);
- }
- }
-
- public static class scale extends org.apache.thrift.AsyncProcessFunction {
- public scale() {
- super("scale");
- }
-
- public scale_args getEmptyArgsInstance() {
- return new scale_args();
- }
-
- public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback() {
- public void onComplete(ScaleResponse o) {
- scale_result result = new scale_result();
- result.success = o;
- try {
- fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- return;
- } catch (Exception e) {
- LOGGER.error("Exception writing to internal frame buffer", e);
- }
- fb.close();
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TBase msg;
- scale_result result = new scale_result();
- {
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- return;
- } catch (Exception ex) {
- LOGGER.error("Exception writing to internal frame buffer", ex);
- }
- fb.close();
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, scale_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
- iface.scale(args.scope, args.stream, args.sealedSegments, args.newKeyRanges, args.scaleTimestamp,resultHandler);
- }
- }
-
- public static class getURI extends org.apache.thrift.AsyncProcessFunction {
- public getURI() {
- super("getURI");
- }
-
- public getURI_args getEmptyArgsInstance() {
- return new getURI_args();
- }
-
- public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback() {
- public void onComplete(NodeUri o) {
- getURI_result result = new getURI_result();
- result.success = o;
- try {
- fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- return;
- } catch (Exception e) {
- LOGGER.error("Exception writing to internal frame buffer", e);
- }
- fb.close();
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TBase msg;
- getURI_result result = new getURI_result();
- {
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- return;
- } catch (Exception ex) {
- LOGGER.error("Exception writing to internal frame buffer", ex);
- }
- fb.close();
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, getURI_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
- iface.getURI(args.segment,resultHandler);
- }
- }
-
- public static class isSegmentValid extends org.apache.thrift.AsyncProcessFunction {
- public isSegmentValid() {
- super("isSegmentValid");
- }
-
- public isSegmentValid_args getEmptyArgsInstance() {
- return new isSegmentValid_args();
- }
-
- public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback() {
- public void onComplete(Boolean o) {
- isSegmentValid_result result = new isSegmentValid_result();
- result.success = o;
- result.setSuccessIsSet(true);
- try {
- fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- return;
- } catch (Exception e) {
- LOGGER.error("Exception writing to internal frame buffer", e);
- }
- fb.close();
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TBase msg;
- isSegmentValid_result result = new isSegmentValid_result();
- {
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- return;
- } catch (Exception ex) {
- LOGGER.error("Exception writing to internal frame buffer", ex);
- }
- fb.close();
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, isSegmentValid_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
- iface.isSegmentValid(args.scope, args.stream, args.segmentNumber,resultHandler);
- }
- }
-
- public static class createTransaction extends org.apache.thrift.AsyncProcessFunction {
- public createTransaction() {
- super("createTransaction");
- }
-
- public createTransaction_args getEmptyArgsInstance() {
- return new createTransaction_args();
- }
-
- public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback() {
- public void onComplete(TxnId o) {
- createTransaction_result result = new createTransaction_result();
- result.success = o;
- try {
- fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- return;
- } catch (Exception e) {
- LOGGER.error("Exception writing to internal frame buffer", e);
- }
- fb.close();
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TBase msg;
- createTransaction_result result = new createTransaction_result();
- {
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- return;
- } catch (Exception ex) {
- LOGGER.error("Exception writing to internal frame buffer", ex);
- }
- fb.close();
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, createTransaction_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
- iface.createTransaction(args.scope, args.stream,resultHandler);
- }
- }
-
- public static class commitTransaction extends org.apache.thrift.AsyncProcessFunction {
- public commitTransaction() {
- super("commitTransaction");
- }
-
- public commitTransaction_args getEmptyArgsInstance() {
- return new commitTransaction_args();
- }
-
- public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback() {
- public void onComplete(TxnStatus o) {
- commitTransaction_result result = new commitTransaction_result();
- result.success = o;
- try {
- fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- return;
- } catch (Exception e) {
- LOGGER.error("Exception writing to internal frame buffer", e);
- }
- fb.close();
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TBase msg;
- commitTransaction_result result = new commitTransaction_result();
- {
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- return;
- } catch (Exception ex) {
- LOGGER.error("Exception writing to internal frame buffer", ex);
- }
- fb.close();
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, commitTransaction_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
- iface.commitTransaction(args.scope, args.stream, args.txnid,resultHandler);
- }
- }
-
- public static class abortTransaction extends org.apache.thrift.AsyncProcessFunction {
- public abortTransaction() {
- super("abortTransaction");
- }
-
- public abortTransaction_args getEmptyArgsInstance() {
- return new abortTransaction_args();
- }
-
- public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback() {
- public void onComplete(TxnStatus o) {
- abortTransaction_result result = new abortTransaction_result();
- result.success = o;
- try {
- fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- return;
- } catch (Exception e) {
- LOGGER.error("Exception writing to internal frame buffer", e);
- }
- fb.close();
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TBase msg;
- abortTransaction_result result = new abortTransaction_result();
- {
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- return;
- } catch (Exception ex) {
- LOGGER.error("Exception writing to internal frame buffer", ex);
- }
- fb.close();
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, abortTransaction_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
- iface.abortTransaction(args.scope, args.stream, args.txnid,resultHandler);
- }
- }
-
- public static class checkTransactionStatus extends org.apache.thrift.AsyncProcessFunction {
- public checkTransactionStatus() {
- super("checkTransactionStatus");
- }
-
- public checkTransactionStatus_args getEmptyArgsInstance() {
- return new checkTransactionStatus_args();
- }
-
- public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback() {
- public void onComplete(TxnState o) {
- checkTransactionStatus_result result = new checkTransactionStatus_result();
- result.success = o;
- try {
- fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- return;
- } catch (Exception e) {
- LOGGER.error("Exception writing to internal frame buffer", e);
- }
- fb.close();
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TBase msg;
- checkTransactionStatus_result result = new checkTransactionStatus_result();
- {
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- return;
- } catch (Exception ex) {
- LOGGER.error("Exception writing to internal frame buffer", ex);
- }
- fb.close();
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, checkTransactionStatus_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
- iface.checkTransactionStatus(args.scope, args.stream, args.txnid,resultHandler);
- }
- }
-
- }
-
- public static class createStream_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("createStream_args");
-
- private static final org.apache.thrift.protocol.TField STREAM_CONFIG_FIELD_DESC = new org.apache.thrift.protocol.TField("streamConfig", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new createStream_argsStandardSchemeFactory());
- schemes.put(TupleScheme.class, new createStream_argsTupleSchemeFactory());
- }
-
- private StreamConfig streamConfig; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- STREAM_CONFIG((short)1, "streamConfig");
-
- private static final Map byName = new HashMap();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // STREAM_CONFIG
- return STREAM_CONFIG;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.STREAM_CONFIG, new org.apache.thrift.meta_data.FieldMetaData("streamConfig", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, StreamConfig.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(createStream_args.class, metaDataMap);
- }
-
- public createStream_args() {
- }
-
- public createStream_args(
- StreamConfig streamConfig)
- {
- this();
- this.streamConfig = streamConfig;
- }
-
- /**
- * Performs a deep copy on other .
- */
- public createStream_args(createStream_args other) {
- if (other.isSetStreamConfig()) {
- this.streamConfig = new StreamConfig(other.streamConfig);
- }
- }
-
- public createStream_args deepCopy() {
- return new createStream_args(this);
- }
-
- @Override
- public void clear() {
- this.streamConfig = null;
- }
-
- public StreamConfig getStreamConfig() {
- return this.streamConfig;
- }
-
- public createStream_args setStreamConfig(StreamConfig streamConfig) {
- this.streamConfig = streamConfig;
- return this;
- }
-
- public void unsetStreamConfig() {
- this.streamConfig = null;
- }
-
- /** Returns true if field streamConfig is set (has been assigned a value) and false otherwise */
- public boolean isSetStreamConfig() {
- return this.streamConfig != null;
- }
-
- public void setStreamConfigIsSet(boolean value) {
- if (!value) {
- this.streamConfig = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STREAM_CONFIG:
- if (value == null) {
- unsetStreamConfig();
- } else {
- setStreamConfig((StreamConfig)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STREAM_CONFIG:
- return getStreamConfig();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case STREAM_CONFIG:
- return isSetStreamConfig();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof createStream_args)
- return this.equals((createStream_args)that);
- return false;
- }
-
- public boolean equals(createStream_args that) {
- if (that == null)
- return false;
-
- boolean this_present_streamConfig = true && this.isSetStreamConfig();
- boolean that_present_streamConfig = true && that.isSetStreamConfig();
- if (this_present_streamConfig || that_present_streamConfig) {
- if (!(this_present_streamConfig && that_present_streamConfig))
- return false;
- if (!this.streamConfig.equals(that.streamConfig))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List list = new ArrayList();
-
- boolean present_streamConfig = true && (isSetStreamConfig());
- list.add(present_streamConfig);
- if (present_streamConfig)
- list.add(streamConfig);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(createStream_args other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetStreamConfig()).compareTo(other.isSetStreamConfig());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStreamConfig()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.streamConfig, other.streamConfig);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("createStream_args(");
- boolean first = true;
-
- sb.append("streamConfig:");
- if (this.streamConfig == null) {
- sb.append("null");
- } else {
- sb.append(this.streamConfig);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- if (streamConfig != null) {
- streamConfig.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class createStream_argsStandardSchemeFactory implements SchemeFactory {
- public createStream_argsStandardScheme getScheme() {
- return new createStream_argsStandardScheme();
- }
- }
-
- private static class createStream_argsStandardScheme extends StandardScheme {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, createStream_args struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // STREAM_CONFIG
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.streamConfig = new StreamConfig();
- struct.streamConfig.read(iprot);
- struct.setStreamConfigIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, createStream_args struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.streamConfig != null) {
- oprot.writeFieldBegin(STREAM_CONFIG_FIELD_DESC);
- struct.streamConfig.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class createStream_argsTupleSchemeFactory implements SchemeFactory {
- public createStream_argsTupleScheme getScheme() {
- return new createStream_argsTupleScheme();
- }
- }
-
- private static class createStream_argsTupleScheme extends TupleScheme {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, createStream_args struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetStreamConfig()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetStreamConfig()) {
- struct.streamConfig.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, createStream_args struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.streamConfig = new StreamConfig();
- struct.streamConfig.read(iprot);
- struct.setStreamConfigIsSet(true);
- }
- }
- }
-
- }
-
- public static class createStream_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("createStream_result");
-
- private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
-
- private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new createStream_resultStandardSchemeFactory());
- schemes.put(TupleScheme.class, new createStream_resultTupleSchemeFactory());
- }
-
- private CreateStreamStatus success; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- /**
- *
- * @see CreateStreamStatus
- */
- SUCCESS((short)0, "success");
-
- private static final Map byName = new HashMap();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 0: // SUCCESS
- return SUCCESS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, CreateStreamStatus.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(createStream_result.class, metaDataMap);
- }
-
- public createStream_result() {
- }
-
- public createStream_result(
- CreateStreamStatus success)
- {
- this();
- this.success = success;
- }
-
- /**
- * Performs a deep copy on other .
- */
- public createStream_result(createStream_result other) {
- if (other.isSetSuccess()) {
- this.success = other.success;
- }
- }
-
- public createStream_result deepCopy() {
- return new createStream_result(this);
- }
-
- @Override
- public void clear() {
- this.success = null;
- }
-
- /**
- *
- * @see CreateStreamStatus
- */
- public CreateStreamStatus getSuccess() {
- return this.success;
- }
-
- /**
- *
- * @see CreateStreamStatus
- */
- public createStream_result setSuccess(CreateStreamStatus success) {
- this.success = success;
- return this;
- }
-
- public void unsetSuccess() {
- this.success = null;
- }
-
- /** Returns true if field success is set (has been assigned a value) and false otherwise */
- public boolean isSetSuccess() {
- return this.success != null;
- }
-
- public void setSuccessIsSet(boolean value) {
- if (!value) {
- this.success = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case SUCCESS:
- if (value == null) {
- unsetSuccess();
- } else {
- setSuccess((CreateStreamStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SUCCESS:
- return getSuccess();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case SUCCESS:
- return isSetSuccess();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof createStream_result)
- return this.equals((createStream_result)that);
- return false;
- }
-
- public boolean equals(createStream_result that) {
- if (that == null)
- return false;
-
- boolean this_present_success = true && this.isSetSuccess();
- boolean that_present_success = true && that.isSetSuccess();
- if (this_present_success || that_present_success) {
- if (!(this_present_success && that_present_success))
- return false;
- if (!this.success.equals(that.success))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List list = new ArrayList();
-
- boolean present_success = true && (isSetSuccess());
- list.add(present_success);
- if (present_success)
- list.add(success.getValue());
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(createStream_result other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSuccess()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("createStream_result(");
- boolean first = true;
-
- sb.append("success:");
- if (this.success == null) {
- sb.append("null");
- } else {
- sb.append(this.success);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class createStream_resultStandardSchemeFactory implements SchemeFactory {
- public createStream_resultStandardScheme getScheme() {
- return new createStream_resultStandardScheme();
- }
- }
-
- private static class createStream_resultStandardScheme extends StandardScheme {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, createStream_result struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 0: // SUCCESS
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.success = com.emc.pravega.controller.stream.api.v1.CreateStreamStatus.findByValue(iprot.readI32());
- struct.setSuccessIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, createStream_result struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.success != null) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- oprot.writeI32(struct.success.getValue());
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class createStream_resultTupleSchemeFactory implements SchemeFactory {
- public createStream_resultTupleScheme getScheme() {
- return new createStream_resultTupleScheme();
- }
- }
-
- private static class createStream_resultTupleScheme extends TupleScheme {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, createStream_result struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetSuccess()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetSuccess()) {
- oprot.writeI32(struct.success.getValue());
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, createStream_result struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.success = com.emc.pravega.controller.stream.api.v1.CreateStreamStatus.findByValue(iprot.readI32());
- struct.setSuccessIsSet(true);
- }
- }
- }
-
- }
-
- public static class alterStream_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("alterStream_args");
-
- private static final org.apache.thrift.protocol.TField STREAM_CONFIG_FIELD_DESC = new org.apache.thrift.protocol.TField("streamConfig", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new alterStream_argsStandardSchemeFactory());
- schemes.put(TupleScheme.class, new alterStream_argsTupleSchemeFactory());
- }
-
- private StreamConfig streamConfig; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- STREAM_CONFIG((short)1, "streamConfig");
-
- private static final Map byName = new HashMap();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // STREAM_CONFIG
- return STREAM_CONFIG;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.STREAM_CONFIG, new org.apache.thrift.meta_data.FieldMetaData("streamConfig", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, StreamConfig.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(alterStream_args.class, metaDataMap);
- }
-
- public alterStream_args() {
- }
-
- public alterStream_args(
- StreamConfig streamConfig)
- {
- this();
- this.streamConfig = streamConfig;
- }
-
- /**
- * Performs a deep copy on other .
- */
- public alterStream_args(alterStream_args other) {
- if (other.isSetStreamConfig()) {
- this.streamConfig = new StreamConfig(other.streamConfig);
- }
- }
-
- public alterStream_args deepCopy() {
- return new alterStream_args(this);
- }
-
- @Override
- public void clear() {
- this.streamConfig = null;
- }
-
- public StreamConfig getStreamConfig() {
- return this.streamConfig;
- }
-
- public alterStream_args setStreamConfig(StreamConfig streamConfig) {
- this.streamConfig = streamConfig;
- return this;
- }
-
- public void unsetStreamConfig() {
- this.streamConfig = null;
- }
-
- /** Returns true if field streamConfig is set (has been assigned a value) and false otherwise */
- public boolean isSetStreamConfig() {
- return this.streamConfig != null;
- }
-
- public void setStreamConfigIsSet(boolean value) {
- if (!value) {
- this.streamConfig = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STREAM_CONFIG:
- if (value == null) {
- unsetStreamConfig();
- } else {
- setStreamConfig((StreamConfig)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STREAM_CONFIG:
- return getStreamConfig();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case STREAM_CONFIG:
- return isSetStreamConfig();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof alterStream_args)
- return this.equals((alterStream_args)that);
- return false;
- }
-
- public boolean equals(alterStream_args that) {
- if (that == null)
- return false;
-
- boolean this_present_streamConfig = true && this.isSetStreamConfig();
- boolean that_present_streamConfig = true && that.isSetStreamConfig();
- if (this_present_streamConfig || that_present_streamConfig) {
- if (!(this_present_streamConfig && that_present_streamConfig))
- return false;
- if (!this.streamConfig.equals(that.streamConfig))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List list = new ArrayList();
-
- boolean present_streamConfig = true && (isSetStreamConfig());
- list.add(present_streamConfig);
- if (present_streamConfig)
- list.add(streamConfig);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(alterStream_args other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetStreamConfig()).compareTo(other.isSetStreamConfig());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStreamConfig()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.streamConfig, other.streamConfig);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("alterStream_args(");
- boolean first = true;
-
- sb.append("streamConfig:");
- if (this.streamConfig == null) {
- sb.append("null");
- } else {
- sb.append(this.streamConfig);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- if (streamConfig != null) {
- streamConfig.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class alterStream_argsStandardSchemeFactory implements SchemeFactory {
- public alterStream_argsStandardScheme getScheme() {
- return new alterStream_argsStandardScheme();
- }
- }
-
- private static class alterStream_argsStandardScheme extends StandardScheme {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, alterStream_args struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // STREAM_CONFIG
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.streamConfig = new StreamConfig();
- struct.streamConfig.read(iprot);
- struct.setStreamConfigIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, alterStream_args struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.streamConfig != null) {
- oprot.writeFieldBegin(STREAM_CONFIG_FIELD_DESC);
- struct.streamConfig.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class alterStream_argsTupleSchemeFactory implements SchemeFactory {
- public alterStream_argsTupleScheme getScheme() {
- return new alterStream_argsTupleScheme();
- }
- }
-
- private static class alterStream_argsTupleScheme extends TupleScheme {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, alterStream_args struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetStreamConfig()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetStreamConfig()) {
- struct.streamConfig.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, alterStream_args struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.streamConfig = new StreamConfig();
- struct.streamConfig.read(iprot);
- struct.setStreamConfigIsSet(true);
- }
- }
- }
-
- }
-
- public static class alterStream_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("alterStream_result");
-
- private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
-
- private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new alterStream_resultStandardSchemeFactory());
- schemes.put(TupleScheme.class, new alterStream_resultTupleSchemeFactory());
- }
-
- private UpdateStreamStatus success; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- /**
- *
- * @see UpdateStreamStatus
- */
- SUCCESS((short)0, "success");
-
- private static final Map byName = new HashMap();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 0: // SUCCESS
- return SUCCESS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, UpdateStreamStatus.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(alterStream_result.class, metaDataMap);
- }
-
- public alterStream_result() {
- }
-
- public alterStream_result(
- UpdateStreamStatus success)
- {
- this();
- this.success = success;
- }
-
- /**
- * Performs a deep copy on other .
- */
- public alterStream_result(alterStream_result other) {
- if (other.isSetSuccess()) {
- this.success = other.success;
- }
- }
-
- public alterStream_result deepCopy() {
- return new alterStream_result(this);
- }
-
- @Override
- public void clear() {
- this.success = null;
- }
-
- /**
- *
- * @see UpdateStreamStatus
- */
- public UpdateStreamStatus getSuccess() {
- return this.success;
- }
-
- /**
- *
- * @see UpdateStreamStatus
- */
- public alterStream_result setSuccess(UpdateStreamStatus success) {
- this.success = success;
- return this;
- }
-
- public void unsetSuccess() {
- this.success = null;
- }
-
- /** Returns true if field success is set (has been assigned a value) and false otherwise */
- public boolean isSetSuccess() {
- return this.success != null;
- }
-
- public void setSuccessIsSet(boolean value) {
- if (!value) {
- this.success = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case SUCCESS:
- if (value == null) {
- unsetSuccess();
- } else {
- setSuccess((UpdateStreamStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SUCCESS:
- return getSuccess();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case SUCCESS:
- return isSetSuccess();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof alterStream_result)
- return this.equals((alterStream_result)that);
- return false;
- }
-
- public boolean equals(alterStream_result that) {
- if (that == null)
- return false;
-
- boolean this_present_success = true && this.isSetSuccess();
- boolean that_present_success = true && that.isSetSuccess();
- if (this_present_success || that_present_success) {
- if (!(this_present_success && that_present_success))
- return false;
- if (!this.success.equals(that.success))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List list = new ArrayList();
-
- boolean present_success = true && (isSetSuccess());
- list.add(present_success);
- if (present_success)
- list.add(success.getValue());
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(alterStream_result other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSuccess()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("alterStream_result(");
- boolean first = true;
-
- sb.append("success:");
- if (this.success == null) {
- sb.append("null");
- } else {
- sb.append(this.success);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class alterStream_resultStandardSchemeFactory implements SchemeFactory {
- public alterStream_resultStandardScheme getScheme() {
- return new alterStream_resultStandardScheme();
- }
- }
-
- private static class alterStream_resultStandardScheme extends StandardScheme {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, alterStream_result struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 0: // SUCCESS
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.success = com.emc.pravega.controller.stream.api.v1.UpdateStreamStatus.findByValue(iprot.readI32());
- struct.setSuccessIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, alterStream_result struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.success != null) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- oprot.writeI32(struct.success.getValue());
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class alterStream_resultTupleSchemeFactory implements SchemeFactory {
- public alterStream_resultTupleScheme getScheme() {
- return new alterStream_resultTupleScheme();
- }
- }
-
- private static class alterStream_resultTupleScheme extends TupleScheme {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, alterStream_result struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetSuccess()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetSuccess()) {
- oprot.writeI32(struct.success.getValue());
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, alterStream_result struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.success = com.emc.pravega.controller.stream.api.v1.UpdateStreamStatus.findByValue(iprot.readI32());
- struct.setSuccessIsSet(true);
- }
- }
- }
-
- }
-
- public static class sealStream_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sealStream_args");
-
- private static final org.apache.thrift.protocol.TField SCOPE_FIELD_DESC = new org.apache.thrift.protocol.TField("scope", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final org.apache.thrift.protocol.TField STREAM_FIELD_DESC = new org.apache.thrift.protocol.TField("stream", org.apache.thrift.protocol.TType.STRING, (short)2);
-
- private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new sealStream_argsStandardSchemeFactory());
- schemes.put(TupleScheme.class, new sealStream_argsTupleSchemeFactory());
- }
-
- private String scope; // required
- private String stream; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SCOPE((short)1, "scope"),
- STREAM((short)2, "stream");
-
- private static final Map byName = new HashMap();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // SCOPE
- return SCOPE;
- case 2: // STREAM
- return STREAM;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SCOPE, new org.apache.thrift.meta_data.FieldMetaData("scope", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.STREAM, new org.apache.thrift.meta_data.FieldMetaData("stream", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sealStream_args.class, metaDataMap);
- }
-
- public sealStream_args() {
- }
-
- public sealStream_args(
- String scope,
- String stream)
- {
- this();
- this.scope = scope;
- this.stream = stream;
- }
-
- /**
- * Performs a deep copy on other .
- */
- public sealStream_args(sealStream_args other) {
- if (other.isSetScope()) {
- this.scope = other.scope;
- }
- if (other.isSetStream()) {
- this.stream = other.stream;
- }
- }
-
- public sealStream_args deepCopy() {
- return new sealStream_args(this);
- }
-
- @Override
- public void clear() {
- this.scope = null;
- this.stream = null;
- }
-
- public String getScope() {
- return this.scope;
- }
-
- public sealStream_args setScope(String scope) {
- this.scope = scope;
- return this;
- }
-
- public void unsetScope() {
- this.scope = null;
- }
-
- /** Returns true if field scope is set (has been assigned a value) and false otherwise */
- public boolean isSetScope() {
- return this.scope != null;
- }
-
- public void setScopeIsSet(boolean value) {
- if (!value) {
- this.scope = null;
- }
- }
-
- public String getStream() {
- return this.stream;
- }
-
- public sealStream_args setStream(String stream) {
- this.stream = stream;
- return this;
- }
-
- public void unsetStream() {
- this.stream = null;
- }
-
- /** Returns true if field stream is set (has been assigned a value) and false otherwise */
- public boolean isSetStream() {
- return this.stream != null;
- }
-
- public void setStreamIsSet(boolean value) {
- if (!value) {
- this.stream = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case SCOPE:
- if (value == null) {
- unsetScope();
- } else {
- setScope((String)value);
- }
- break;
-
- case STREAM:
- if (value == null) {
- unsetStream();
- } else {
- setStream((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SCOPE:
- return getScope();
-
- case STREAM:
- return getStream();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case SCOPE:
- return isSetScope();
- case STREAM:
- return isSetStream();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof sealStream_args)
- return this.equals((sealStream_args)that);
- return false;
- }
-
- public boolean equals(sealStream_args that) {
- if (that == null)
- return false;
-
- boolean this_present_scope = true && this.isSetScope();
- boolean that_present_scope = true && that.isSetScope();
- if (this_present_scope || that_present_scope) {
- if (!(this_present_scope && that_present_scope))
- return false;
- if (!this.scope.equals(that.scope))
- return false;
- }
-
- boolean this_present_stream = true && this.isSetStream();
- boolean that_present_stream = true && that.isSetStream();
- if (this_present_stream || that_present_stream) {
- if (!(this_present_stream && that_present_stream))
- return false;
- if (!this.stream.equals(that.stream))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List list = new ArrayList();
-
- boolean present_scope = true && (isSetScope());
- list.add(present_scope);
- if (present_scope)
- list.add(scope);
-
- boolean present_stream = true && (isSetStream());
- list.add(present_stream);
- if (present_stream)
- list.add(stream);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(sealStream_args other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetScope()).compareTo(other.isSetScope());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetScope()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.scope, other.scope);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetStream()).compareTo(other.isSetStream());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStream()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stream, other.stream);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("sealStream_args(");
- boolean first = true;
-
- sb.append("scope:");
- if (this.scope == null) {
- sb.append("null");
- } else {
- sb.append(this.scope);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("stream:");
- if (this.stream == null) {
- sb.append("null");
- } else {
- sb.append(this.stream);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class sealStream_argsStandardSchemeFactory implements SchemeFactory {
- public sealStream_argsStandardScheme getScheme() {
- return new sealStream_argsStandardScheme();
- }
- }
-
- private static class sealStream_argsStandardScheme extends StandardScheme {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, sealStream_args struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // SCOPE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.scope = iprot.readString();
- struct.setScopeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // STREAM
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.stream = iprot.readString();
- struct.setStreamIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, sealStream_args struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.scope != null) {
- oprot.writeFieldBegin(SCOPE_FIELD_DESC);
- oprot.writeString(struct.scope);
- oprot.writeFieldEnd();
- }
- if (struct.stream != null) {
- oprot.writeFieldBegin(STREAM_FIELD_DESC);
- oprot.writeString(struct.stream);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class sealStream_argsTupleSchemeFactory implements SchemeFactory {
- public sealStream_argsTupleScheme getScheme() {
- return new sealStream_argsTupleScheme();
- }
- }
-
- private static class sealStream_argsTupleScheme extends TupleScheme {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, sealStream_args struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetScope()) {
- optionals.set(0);
- }
- if (struct.isSetStream()) {
- optionals.set(1);
- }
- oprot.writeBitSet(optionals, 2);
- if (struct.isSetScope()) {
- oprot.writeString(struct.scope);
- }
- if (struct.isSetStream()) {
- oprot.writeString(struct.stream);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, sealStream_args struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(2);
- if (incoming.get(0)) {
- struct.scope = iprot.readString();
- struct.setScopeIsSet(true);
- }
- if (incoming.get(1)) {
- struct.stream = iprot.readString();
- struct.setStreamIsSet(true);
- }
- }
- }
-
- }
-
- public static class sealStream_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sealStream_result");
-
- private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
-
- private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new sealStream_resultStandardSchemeFactory());
- schemes.put(TupleScheme.class, new sealStream_resultTupleSchemeFactory());
- }
-
- private UpdateStreamStatus success; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- /**
- *
- * @see UpdateStreamStatus
- */
- SUCCESS((short)0, "success");
-
- private static final Map byName = new HashMap();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 0: // SUCCESS
- return SUCCESS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, UpdateStreamStatus.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sealStream_result.class, metaDataMap);
- }
-
- public sealStream_result() {
- }
-
- public sealStream_result(
- UpdateStreamStatus success)
- {
- this();
- this.success = success;
- }
-
- /**
- * Performs a deep copy on other .
- */
- public sealStream_result(sealStream_result other) {
- if (other.isSetSuccess()) {
- this.success = other.success;
- }
- }
-
- public sealStream_result deepCopy() {
- return new sealStream_result(this);
- }
-
- @Override
- public void clear() {
- this.success = null;
- }
-
- /**
- *
- * @see UpdateStreamStatus
- */
- public UpdateStreamStatus getSuccess() {
- return this.success;
- }
-
- /**
- *
- * @see UpdateStreamStatus
- */
- public sealStream_result setSuccess(UpdateStreamStatus success) {
- this.success = success;
- return this;
- }
-
- public void unsetSuccess() {
- this.success = null;
- }
-
- /** Returns true if field success is set (has been assigned a value) and false otherwise */
- public boolean isSetSuccess() {
- return this.success != null;
- }
-
- public void setSuccessIsSet(boolean value) {
- if (!value) {
- this.success = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case SUCCESS:
- if (value == null) {
- unsetSuccess();
- } else {
- setSuccess((UpdateStreamStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SUCCESS:
- return getSuccess();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case SUCCESS:
- return isSetSuccess();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof sealStream_result)
- return this.equals((sealStream_result)that);
- return false;
- }
-
- public boolean equals(sealStream_result that) {
- if (that == null)
- return false;
-
- boolean this_present_success = true && this.isSetSuccess();
- boolean that_present_success = true && that.isSetSuccess();
- if (this_present_success || that_present_success) {
- if (!(this_present_success && that_present_success))
- return false;
- if (!this.success.equals(that.success))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List list = new ArrayList();
-
- boolean present_success = true && (isSetSuccess());
- list.add(present_success);
- if (present_success)
- list.add(success.getValue());
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(sealStream_result other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSuccess()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("sealStream_result(");
- boolean first = true;
-
- sb.append("success:");
- if (this.success == null) {
- sb.append("null");
- } else {
- sb.append(this.success);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class sealStream_resultStandardSchemeFactory implements SchemeFactory {
- public sealStream_resultStandardScheme getScheme() {
- return new sealStream_resultStandardScheme();
- }
- }
-
- private static class sealStream_resultStandardScheme extends StandardScheme {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, sealStream_result struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 0: // SUCCESS
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.success = com.emc.pravega.controller.stream.api.v1.UpdateStreamStatus.findByValue(iprot.readI32());
- struct.setSuccessIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, sealStream_result struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.success != null) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- oprot.writeI32(struct.success.getValue());
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class sealStream_resultTupleSchemeFactory implements SchemeFactory {
- public sealStream_resultTupleScheme getScheme() {
- return new sealStream_resultTupleScheme();
- }
- }
-
- private static class sealStream_resultTupleScheme extends TupleScheme {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, sealStream_result struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetSuccess()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetSuccess()) {
- oprot.writeI32(struct.success.getValue());
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, sealStream_result struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.success = com.emc.pravega.controller.stream.api.v1.UpdateStreamStatus.findByValue(iprot.readI32());
- struct.setSuccessIsSet(true);
- }
- }
- }
-
- }
-
- public static class getCurrentSegments_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getCurrentSegments_args");
-
- private static final org.apache.thrift.protocol.TField SCOPE_FIELD_DESC = new org.apache.thrift.protocol.TField("scope", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final org.apache.thrift.protocol.TField STREAM_FIELD_DESC = new org.apache.thrift.protocol.TField("stream", org.apache.thrift.protocol.TType.STRING, (short)2);
-
- private static final Map, SchemeFactory> schemes = new HashMap