Search in sources :

Example 26 with Path

use of com.yahoo.path.Path in project vespa by vespa-engine.

the class ZKApplicationFile method listFiles.

@Override
public List<ApplicationFile> listFiles(PathFilter filter) {
    String userPath = getZKPath(path);
    List<ApplicationFile> ret = new ArrayList<>();
    for (String zkChild : zkApp.getChildren(userPath)) {
        Path childPath = path.append(zkChild);
        // Ignore dot-files.
        if (!childPath.getName().startsWith(".") && filter.accept(childPath)) {
            ret.add(new ZKApplicationFile(childPath, zkApp));
        }
    }
    return ret;
}
Also used : Path(com.yahoo.path.Path) ApplicationFile(com.yahoo.config.application.api.ApplicationFile) ArrayList(java.util.ArrayList)

Example 27 with Path

use of com.yahoo.path.Path in project vespa by vespa-engine.

the class ZooKeeperClientTest method testWritingHostNamesToZooKeeper.

@Test
public void testWritingHostNamesToZooKeeper() throws IOException {
    ConfigCurator zk = ConfigCurator.create(new MockCurator());
    BaseDeployLogger logger = new BaseDeployLogger();
    Path app = Path.fromString("/1");
    ZooKeeperClient zooKeeperClient = new ZooKeeperClient(zk, logger, true, app);
    zooKeeperClient.setupZooKeeper();
    HostSpec host1 = new HostSpec("host1.yahoo.com", Collections.emptyList());
    HostSpec host2 = new HostSpec("host2.yahoo.com", Collections.emptyList());
    ImmutableSet<HostSpec> hosts = ImmutableSet.of(host1, host2);
    zooKeeperClient.write(AllocatedHosts.withHosts(hosts));
    Path hostsPath = app.append(ZKApplicationPackage.allocatedHostsNode);
    assertTrue(zk.exists(hostsPath.getAbsolute()));
    AllocatedHosts deserialized = AllocatedHosts.fromJson(zk.getBytes(hostsPath.getAbsolute()), Optional.empty());
    assertEquals(hosts, deserialized.getHosts());
}
Also used : Path(com.yahoo.path.Path) ConfigCurator(com.yahoo.vespa.config.server.zookeeper.ConfigCurator) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) Test(org.junit.Test)

Example 28 with Path

use of com.yahoo.path.Path in project vespa by vespa-engine.

the class CuratorDb method lockPath.

private Path lockPath(String provisionId) {
    Path lockPath = lockRoot.append(provisionStatePath()).append(provisionId);
    curator.create(lockPath);
    return lockPath;
}
Also used : Path(com.yahoo.path.Path)

Example 29 with Path

use of com.yahoo.path.Path in project vespa by vespa-engine.

the class CuratorDb method lockPath.

private Path lockPath(ApplicationId application) {
    Path lockPath = lockRoot.append(application.tenant().value()).append(application.application().value()).append(application.instance().value());
    curator.create(lockPath);
    return lockPath;
}
Also used : Path(com.yahoo.path.Path)

Example 30 with Path

use of com.yahoo.path.Path in project vespa by vespa-engine.

the class CuratorDb method lockPath.

// -------------- Paths --------------------------------------------------
private Path lockPath(TenantId tenant) {
    Path lockPath = lockRoot.append(tenant.id());
    curator.create(lockPath);
    return lockPath;
}
Also used : Path(com.yahoo.path.Path)

Aggregations

Path (com.yahoo.path.Path)32 Test (org.junit.Test)10 ApplicationFile (com.yahoo.config.application.api.ApplicationFile)4 ConfigCurator (com.yahoo.vespa.config.server.zookeeper.ConfigCurator)4 File (java.io.File)4 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)3 Node (com.yahoo.vespa.curator.mock.MemoryFileSystem.Node)3 MockCurator (com.yahoo.vespa.curator.mock.MockCurator)3 KeeperException (org.apache.zookeeper.KeeperException)3 RankingConstant (com.yahoo.searchdefinition.RankingConstant)2 Curator (com.yahoo.vespa.curator.Curator)2 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)1 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)1 ApplicationId (com.yahoo.config.provision.ApplicationId)1 TenantName (com.yahoo.config.provision.TenantName)1 NamedReader (com.yahoo.io.reader.NamedReader)1 RankProfile (com.yahoo.searchdefinition.RankProfile)1 Tensor (com.yahoo.tensor.Tensor)1 TensorType (com.yahoo.tensor.TensorType)1 NestedTransaction (com.yahoo.transaction.NestedTransaction)1