blob: 2de88ab44cc3d96cf35b81d813878c8eeaedcb33 (
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
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.rpc;
import com.yahoo.text.Utf8Array;
import com.yahoo.vespa.config.ConfigPayload;
import com.yahoo.vespa.config.protocol.CompressionInfo;
import com.yahoo.vespa.config.protocol.CompressionType;
import com.yahoo.vespa.config.protocol.ConfigResponse;
import com.yahoo.vespa.config.protocol.SlimeConfigResponse;
import com.yahoo.vespa.config.util.ConfigUtils;
/**
* Simply returns an uncompressed payload.
*
* @author Ulf Lilleengen
*/
public class UncompressedConfigResponseFactory implements ConfigResponseFactory {
@Override
public ConfigResponse createResponse(ConfigPayload payload,
long generation,
boolean internalRedeploy) {
Utf8Array rawPayload = payload.toUtf8Array(true);
String configMd5 = ConfigUtils.getMd5(rawPayload);
CompressionInfo info = CompressionInfo.create(CompressionType.UNCOMPRESSED, rawPayload.getByteLength());
return new SlimeConfigResponse(rawPayload, generation, internalRedeploy, configMd5, info);
}
}
|