Search in sources :

Example 1 with FileReference

use of com.yahoo.config.FileReference in project vespa by vespa-engine.

the class ContainerCluster method addAndSendApplicationBundles.

private void addAndSendApplicationBundles() {
    for (ComponentInfo component : getRoot().getDeployState().getApplicationPackage().getComponentsInfo(getRoot().getDeployState().getProperties().vespaVersion())) {
        FileReference reference = FileSender.sendFileToServices(component.getPathRelativeToAppDir(), containers);
        applicationBundles.add(reference);
    }
}
Also used : ComponentInfo(com.yahoo.config.application.api.ComponentInfo) FileReference(com.yahoo.config.FileReference)

Example 2 with FileReference

use of com.yahoo.config.FileReference in project vespa by vespa-engine.

the class FileSender method sendUserConfiguredFiles.

/**
 * Sends all user configured files for a producer to all given services.
 */
public static <PRODUCER extends AbstractConfigProducer<?>> void sendUserConfiguredFiles(PRODUCER producer, Collection<? extends AbstractService> services, DeployLogger logger) {
    if (services.isEmpty())
        return;
    UserConfigRepo userConfigs = producer.getUserConfigs();
    Map<String, FileReference> sentFiles = new HashMap<>();
    for (ConfigDefinitionKey key : userConfigs.configsProduced()) {
        ConfigPayloadBuilder builder = userConfigs.get(key);
        try {
            sendUserConfiguredFiles(builder, sentFiles, services, key, logger);
        } catch (IllegalArgumentException e) {
            throw new IllegalArgumentException("Unable to send files for " + key, e);
        }
    }
}
Also used : UserConfigRepo(com.yahoo.config.model.producer.UserConfigRepo) FileReference(com.yahoo.config.FileReference)

Example 3 with FileReference

use of com.yahoo.config.FileReference in project vespa by vespa-engine.

the class FileSender method sendFileEntry.

private static void sendFileEntry(ConfigPayloadBuilder builder, Map<String, FileReference> sentFiles, Collection<? extends AbstractService> services) {
    String path = builder.getValue();
    FileReference reference = sentFiles.get(path);
    if (reference == null) {
        reference = sendFileToServices(path, services);
        sentFiles.put(path, reference);
    }
    builder.setValue(reference.value());
}
Also used : FileReference(com.yahoo.config.FileReference)

Example 4 with FileReference

use of com.yahoo.config.FileReference in project vespa by vespa-engine.

the class AbstractSearchCluster method prepareToDistributeFiles.

public void prepareToDistributeFiles(List<SearchNode> backends) {
    for (SearchDefinitionSpec sds : localSDS) {
        for (RankingConstant constant : sds.getSearchDefinition().getSearch().getRankingConstants().values()) {
            FileReference reference = (constant.getPathType() == RankingConstant.PathType.FILE) ? FileSender.sendFileToServices(constant.getFileName(), backends) : FileSender.sendUriToServices(constant.getUri(), backends);
            constant.setFileReference(reference.value());
        }
    }
}
Also used : FileReference(com.yahoo.config.FileReference) RankingConstant(com.yahoo.searchdefinition.RankingConstant)

Example 5 with FileReference

use of com.yahoo.config.FileReference in project vespa by vespa-engine.

the class FileDistributor method sendFileToHosts.

/**
 * Adds the given file to the associated application packages' registry of file and marks the file
 * for distribution to the given hosts.
 * <b>Note: This class receives ownership of the given collection.</b>
 *
 * @return the reference to the file, created by the application package
 */
public FileReference sendFileToHosts(String relativePath, Collection<Host> hosts) {
    FileReference reference = fileRegistry.addFile(relativePath);
    addToFilesToDistribute(reference, hosts);
    return reference;
}
Also used : FileReference(com.yahoo.config.FileReference)

Aggregations

FileReference (com.yahoo.config.FileReference)37 Test (org.junit.Test)10 File (java.io.File)9 Int32Value (com.yahoo.jrt.Int32Value)4 IOException (java.io.IOException)3 Bundle (org.osgi.framework.Bundle)3 StringValue (com.yahoo.jrt.StringValue)2 CompressedFileReference (com.yahoo.vespa.filedistribution.CompressedFileReference)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ByteBuffer (java.nio.ByteBuffer)2 FileAlreadyExistsException (java.nio.file.FileAlreadyExistsException)2 Optional (java.util.Optional)2 ComponentSpecification (com.yahoo.component.ComponentSpecification)1 ConfigBuilder (com.yahoo.config.ConfigBuilder)1 ComponentInfo (com.yahoo.config.application.api.ComponentInfo)1 MockFileRegistry (com.yahoo.config.model.application.provider.MockFileRegistry)1 UserConfigRepo (com.yahoo.config.model.producer.UserConfigRepo)1 MockHosts (com.yahoo.config.model.test.MockHosts)1 BundleInstantiationSpecification (com.yahoo.container.bundle.BundleInstantiationSpecification)1 CloudSubscriberFactory (com.yahoo.container.di.CloudSubscriberFactory)1