summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/schema/RankExpressionBody.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/main/java/com/yahoo/schema/RankExpressionBody.java')
-rw-r--r--config-model/src/main/java/com/yahoo/schema/RankExpressionBody.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/RankExpressionBody.java b/config-model/src/main/java/com/yahoo/schema/RankExpressionBody.java
new file mode 100644
index 00000000000..d383a25aecb
--- /dev/null
+++ b/config-model/src/main/java/com/yahoo/schema/RankExpressionBody.java
@@ -0,0 +1,32 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.schema;
+
+import com.yahoo.config.application.api.FileRegistry;
+
+import java.nio.ByteBuffer;
+
+import static java.util.Objects.requireNonNull;
+
+public class RankExpressionBody extends DistributableResource {
+
+ private final ByteBuffer blob;
+
+ public RankExpressionBody(String name, ByteBuffer blob) {
+ super(name, name + ".lz4", PathType.BLOB);
+ this.blob = requireNonNull(blob, "Blob cannot be null");
+ }
+
+ public ByteBuffer getBlob() { return blob; }
+
+ public void validate() {
+ // Remove once pathType is final
+ if (getPathType() != PathType.BLOB) {
+ throw new IllegalArgumentException("PathType must be BLOB.");
+ }
+ }
+
+ public void register(FileRegistry fileRegistry) {
+ register(fileRegistry, blob);
+ }
+
+}