blob: a6951efee1ebc16ddc6bb6b26a5106ef111e2d0d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.documentapi.messagebus.protocol;
import com.yahoo.document.BucketId;
import java.util.ArrayList;
import java.util.List;
public class DocumentListMessage extends VisitorMessage {
private BucketId bucket = new BucketId(16, 0);
private final List<DocumentListEntry> entries = new ArrayList<DocumentListEntry>();
public DocumentListMessage() {
// empty
}
public DocumentListMessage(DocumentListMessage cmd) {
bucket = cmd.bucket;
entries.addAll(cmd.entries);
}
public BucketId getBucketId() {
return bucket;
}
public void setBucketId(BucketId id) {
bucket = id;
}
public List<DocumentListEntry> getDocuments() {
return entries;
}
@Override
public DocumentReply createReply() {
return new VisitorReply(DocumentProtocol.REPLY_DOCUMENTLIST);
}
@Override
public int getType() {
return DocumentProtocol.MESSAGE_DOCUMENTLIST;
}
@Override
public int getApproxSize() {
return DocumentListEntry.getApproxSize() * entries.size();
}
@Override
public String toString() {
return "DocumentListMessage(" + entries.toString() + ")";
}
}
|