Search in sources :

Example 31 with Path

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

the class CuratorDatabaseClient method lockPath.

/**
 * Creates an returns the path to the lock for this application
 */
private Path lockPath(ApplicationId application) {
    Path lockPath = root.append("locks").append(application.tenant().value()).append(application.application().value()).append(application.instance().value());
    curatorDatabase.create(lockPath);
    return lockPath;
}
Also used : Path(com.yahoo.path.Path)

Example 32 with Path

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

the class CuratorDatabaseClient method removeNodes.

/**
 * Removes multiple nodes in a single transaction.
 *
 * @param nodes list of the nodes to remove
 */
public void removeNodes(List<Node> nodes) {
    NestedTransaction transaction = new NestedTransaction();
    for (Node node : nodes) {
        Path path = toPath(node.state(), node.hostname());
        CuratorTransaction curatorTransaction = curatorDatabase.newCuratorTransactionIn(transaction);
        curatorTransaction.add(CuratorOperations.delete(path.getAbsolute()));
    }
    transaction.commit();
    nodes.forEach(node -> log.log(LogLevel.INFO, "Removed node " + node.hostname() + " in state " + node.state()));
}
Also used : Path(com.yahoo.path.Path) CuratorTransaction(com.yahoo.vespa.curator.transaction.CuratorTransaction) Node(com.yahoo.vespa.hosted.provision.Node) NestedTransaction(com.yahoo.transaction.NestedTransaction)

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