All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.schema.RankingExpressionBody Maven / Gradle / Ivy

There is a newer version: 8.441.21
Show newest version
// Copyright Vespa.ai. 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 RankingExpressionBody extends DistributableResource {

    private final ByteBuffer blob;

    public RankingExpressionBody(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);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy