Search in sources :

Example 1 with PendingReplicationActions

use of org.opensearch.action.support.replication.PendingReplicationActions in project OpenSearch by opensearch-project.

the class TransportVerifyShardBeforeCloseActionTests method createPrimary.

private static ReplicationOperation.Primary<TransportVerifyShardBeforeCloseAction.ShardRequest, TransportVerifyShardBeforeCloseAction.ShardRequest, PrimaryResult> createPrimary(final ShardRouting primary, final ReplicationGroup replicationGroup) {
    final PendingReplicationActions replicationActions = new PendingReplicationActions(primary.shardId(), threadPool);
    replicationActions.accept(replicationGroup);
    return new ReplicationOperation.Primary<TransportVerifyShardBeforeCloseAction.ShardRequest, TransportVerifyShardBeforeCloseAction.ShardRequest, PrimaryResult>() {

        @Override
        public ShardRouting routingEntry() {
            return primary;
        }

        @Override
        public PendingReplicationActions getPendingReplicationActions() {
            return replicationActions;
        }

        @Override
        public ReplicationGroup getReplicationGroup() {
            return replicationGroup;
        }

        @Override
        public void perform(TransportVerifyShardBeforeCloseAction.ShardRequest request, ActionListener<PrimaryResult> listener) {
            listener.onResponse(new PrimaryResult(request));
        }

        @Override
        public void failShard(String message, Exception exception) {
        }

        @Override
        public void updateLocalCheckpointForShard(String allocationId, long checkpoint) {
        }

        @Override
        public void updateGlobalCheckpointForShard(String allocationId, long globalCheckpoint) {
        }

        @Override
        public long localCheckpoint() {
            return 0;
        }

        @Override
        public long computedGlobalCheckpoint() {
            return 0;
        }

        @Override
        public long globalCheckpoint() {
            return 0;
        }

        @Override
        public long maxSeqNoOfUpdatesOrDeletes() {
            return 0;
        }
    };
}
Also used : ActionListener(org.opensearch.action.ActionListener) PendingReplicationActions(org.opensearch.action.support.replication.PendingReplicationActions) ConcreteShardRequest(org.opensearch.action.support.replication.TransportReplicationAction.ConcreteShardRequest) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)1 ActionListener (org.opensearch.action.ActionListener)1 PendingReplicationActions (org.opensearch.action.support.replication.PendingReplicationActions)1 ConcreteShardRequest (org.opensearch.action.support.replication.TransportReplicationAction.ConcreteShardRequest)1