summaryrefslogtreecommitdiffstats
path: root/document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializerHead.java
blob: 66bc8cbb4d57c5e3ca45e94d241d2ca4cb8ed514 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document.serialization;

import com.yahoo.document.update.TensorAddUpdate;
import com.yahoo.document.update.TensorModifyUpdate;
import com.yahoo.document.update.TensorRemoveUpdate;
import com.yahoo.io.GrowableByteBuffer;

/**
 * Class used for serializing documents on the current head document format.
 *
 * @author baldersheim
 */
public class VespaDocumentSerializerHead extends VespaDocumentSerializer6 {

    public VespaDocumentSerializerHead(GrowableByteBuffer buf) {
        super(buf);
    }

    @Override
    public void write(TensorModifyUpdate update) {
        putByte(null, (byte) update.getOperation().id);
        update.getValue().serialize(this);
    }

    @Override
    public void write(TensorAddUpdate update) {
        update.getValue().serialize(this);
    }

    @Override
    public void write(TensorRemoveUpdate update) {
        update.getValue().serialize(this);
    }


}