blob: 9053c69ea1d5e6486c5b07b01c4231f452391bf1 (
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
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.documentapi.metrics;
import com.yahoo.documentapi.messagebus.protocol.PutDocumentMessage;
import com.yahoo.documentapi.messagebus.protocol.RemoveDocumentMessage;
import com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage;
import com.yahoo.messagebus.Message;
/**
* @author freva
*/
public enum DocumentOperationType {
PUT, REMOVE, UPDATE, ERROR;
public static DocumentOperationType fromMessage(Message msg) {
if (msg instanceof PutDocumentMessage) {
return PUT;
} else if (msg instanceof RemoveDocumentMessage) {
return REMOVE;
} else if (msg instanceof UpdateDocumentMessage) {
return UPDATE;
} else {
return ERROR;
}
}
}
|