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