class ShardRequest<T extends ShardRequest<T, I>, I extends ShardRequest.Item>
    extends ReplicationRequest<T>
    implements Iterable<I>, Accountable {

    private static final long SHALLOW_SIZE = RamUsageEstimator.shallowSizeOfInstance(ShardRequest.class);

    private final UUID jobId;
    protected List<I> items;

    public ShardRequest(ShardId shardId, UUID jobId) {
        setShardId(shardId);
        this.jobId = jobId;
        this.index = shardId.getIndexName();
        this.items = new ArrayList<>();
    }

    public void add(int location, I item) {
        item.location(location);
        items.add(item);
    }

    public List<I> items() {
        return items;
    }

    @Override
    public Iterator<I> iterator() {
        return Collections.unmodifiableCollection(items).iterator();
    }

    public UUID jobId() {
        return jobId;
    }

    public ShardRequest(StreamInput in) throws IOException {
        super(in);
        jobId = new UUID(in.readLong(), in.readLong());
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        super.writeTo(out);
        out.writeLong(jobId.getMostSignificantBits());
        out.writeLong(jobId.getLeastSignificantBits());
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ShardRequest<?, ?> that = (ShardRequest<?, ?>) o;
        return Objects.equals(jobId, that.jobId) &&
               Objects.equals(items, that.items);
    }

    @Override
    public int hashCode() {
        return Objects.hash(jobId, items);
    }

    /**
     * The description is used when creating transport, replication and search tasks and it defaults to `toString`.
     * Only return the shard id to avoid the overhead of including all the items.
     */

    @Override
    public String toString() {<FILL_FUNCTION_BODY>}

    @Override
    public long ramBytesUsed() {
        long bytes = SHALLOW_SIZE;
        for (var item : items) {
            bytes += item.ramBytesUsed();
        }
        return bytes;
    }

    public abstract static class Item implements Writeable, Accountable {

        protected final String id;
        protected long version = Versions.MATCH_ANY;

        private int location = -1;
        protected long seqNo = SequenceNumbers.UNASSIGNED_SEQ_NO;
        protected long primaryTerm = SequenceNumbers.UNASSIGNED_PRIMARY_TERM;

        public Item(String id) {
            this.id = id;
        }

        protected Item(StreamInput in) throws IOException {
            id = in.readString();
            version = in.readLong();
            location = in.readInt();
            seqNo = in.readLong();
            primaryTerm = in.readLong();
        }

        @Override
        public long ramBytesUsed() {
            return RamUsageEstimator.sizeOf(id)
                + Long.BYTES    // version
                + Integer.BYTES // location
                + Long.BYTES    // seqNo
                + Long.BYTES;   // primaryTerm
        }

        public String id() {
            return id;
        }

        public long version() {
            return version;
        }

        public void version(long version) {
            this.version = version;
        }

        public void location(int location) {
            this.location = location;
        }

        public int location() {
            return location;
        }

        public long seqNo() {
            return seqNo;
        }

        public void seqNo(long seqNo) {
            this.seqNo = seqNo;
        }

        public long primaryTerm() {
            return primaryTerm;
        }

        public void primaryTerm(long primaryTerm) {
            this.primaryTerm = primaryTerm;
        }

        public void writeTo(StreamOutput out) throws IOException {
            out.writeString(id);
            out.writeLong(version);
            out.writeInt(location);
            out.writeLong(seqNo);
            out.writeLong(primaryTerm);
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Item item = (Item) o;
            return version == item.version &&
                   location == item.location &&
                   seqNo == item.seqNo &&
                   primaryTerm == item.primaryTerm &&
                   java.util.Objects.equals(id, item.id);
        }

        @Override
        public int hashCode() {
            return java.util.Objects.hash(id, version, location, seqNo, primaryTerm);
        }

        @Override
        public String toString() {
            return "Item{" +
                   "id='" + id + '\'' +
                   ", version=" + version +
                   ", location=" + location +
                   ", seqNo=" + seqNo +
                   ", primaryTerm=" + primaryTerm +
                   '}';
        }
    }

}

        return "ShardRequest{" +
               ", shardId=" + shardId +
               ", timeout=" + timeout +
               '}';
    
<methods>public void <init>() ,public void <init>(org.elasticsearch.index.shard.ShardId) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public java.lang.String getDescription() ,public java.lang.String index() ,public final T index(java.lang.String) ,public java.lang.String[] indices() ,public org.elasticsearch.action.support.IndicesOptions indicesOptions() ,public void onRetry() ,public T setShardId(org.elasticsearch.index.shard.ShardId) ,public org.elasticsearch.index.shard.ShardId shardId() ,public final T timeout(io.crate.common.unit.TimeValue) ,public final T timeout(java.lang.String) ,public io.crate.common.unit.TimeValue timeout() ,public abstract java.lang.String toString() ,public org.elasticsearch.action.support.ActiveShardCount waitForActiveShards() ,public final T waitForActiveShards(org.elasticsearch.action.support.ActiveShardCount) ,public final T waitForActiveShards(int) ,public void writeTo(org.elasticsearch.common.io.stream.StreamOutput) throws java.io.IOException<variables>public static final io.crate.common.unit.TimeValue DEFAULT_TIMEOUT,protected java.lang.String index,private long routedBasedOnClusterVersion,protected org.elasticsearch.index.shard.ShardId shardId,protected io.crate.common.unit.TimeValue timeout,protected org.elasticsearch.action.support.ActiveShardCount waitForActiveShards