Package com.apple.foundationdb
Class TenantManagement
- java.lang.Object
-
- com.apple.foundationdb.TenantManagement
-
public class TenantManagement extends java.lang.Object
The FoundationDB API includes function to manage the set of tenants in a cluster.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.concurrent.CompletableFuture<java.lang.Void>
createTenant(Database db, byte[] tenantName)
Creates a new tenant in the cluster using a transaction created on the specifiedDatabase
.static java.util.concurrent.CompletableFuture<java.lang.Void>
createTenant(Database db, Tuple tenantName)
Creates a new tenant in the cluster using a transaction created on the specifiedDatabase
.static void
createTenant(Transaction tr, byte[] tenantName)
Creates a new tenant in the cluster.static void
createTenant(Transaction tr, Tuple tenantName)
Creates a new tenant in the cluster.static java.util.concurrent.CompletableFuture<java.lang.Void>
deleteTenant(Database db, byte[] tenantName)
Deletes a tenant from the cluster using a transaction created on the specifiedDatabase
.static java.util.concurrent.CompletableFuture<java.lang.Void>
deleteTenant(Database db, Tuple tenantName)
Deletes a tenant from the cluster using a transaction created on the specifiedDatabase
.static void
deleteTenant(Transaction tr, byte[] tenantName)
Deletes a tenant from the cluster.static void
deleteTenant(Transaction tr, Tuple tenantName)
Deletes a tenant from the cluster.
-
-
-
Method Detail
-
createTenant
public static void createTenant(Transaction tr, byte[] tenantName)
Creates a new tenant in the cluster. If the tenant already exists, this operation will complete successfully without changing anything. The transaction must be committed for the creation to take effect or to observe any errors.- Parameters:
tr
- The transaction used to create the tenant.tenantName
- The name of the tenant. Can be any byte string that does not begin a 0xFF byte.
-
createTenant
public static void createTenant(Transaction tr, Tuple tenantName)
Creates a new tenant in the cluster. If the tenant already exists, this operation will complete successfully without changing anything. The transaction must be committed for the creation to take effect or to observe any errors.
This is a convenience method that generates the tenant name by packing aTuple
.- Parameters:
tr
- The transaction used to create the tenant.tenantName
- The name of the tenant, as a Tuple.
-
createTenant
public static java.util.concurrent.CompletableFuture<java.lang.Void> createTenant(Database db, byte[] tenantName)
Creates a new tenant in the cluster using a transaction created on the specifiedDatabase
. This operation will first check whether the tenant exists, and if it does it will set theCompletableFuture
to a tenant_already_exists error. Otherwise, it will attempt to create the tenant in a retry loop. If the tenant is created concurrently by another transaction, this function may still return successfully.- Parameters:
db
- The database used to create a transaction for creating the tenant.tenantName
- The name of the tenant. Can be any byte string that does not begin a 0xFF byte.- Returns:
- a
CompletableFuture
that when set without error will indicate that the tenant has been created.
-
createTenant
public static java.util.concurrent.CompletableFuture<java.lang.Void> createTenant(Database db, Tuple tenantName)
Creates a new tenant in the cluster using a transaction created on the specifiedDatabase
. This operation will first check whether the tenant exists, and if it does it will set theCompletableFuture
to a tenant_already_exists error. Otherwise, it will attempt to create the tenant in a retry loop. If the tenant is created concurrently by another transaction, this function may still return successfully.
This is a convenience method that generates the tenant name by packing aTuple
.- Parameters:
db
- The database used to create a transaction for creating the tenant.tenantName
- The name of the tenant, as a Tuple.- Returns:
- a
CompletableFuture
that when set without error will indicate that the tenant has been created.
-
deleteTenant
public static void deleteTenant(Transaction tr, byte[] tenantName)
Deletes a tenant from the cluster. If the tenant does not exists, this operation will complete successfully without changing anything. The transaction must be committed for the deletion to take effect or to observe any errors.
Note: A tenant cannot be deleted if it has any data in it. To delete a non-empty tenant, you must first use a clear operation to delete all of its keys.- Parameters:
tr
- The transaction used to delete the tenant.tenantName
- The name of the tenant being deleted.
-
deleteTenant
public static void deleteTenant(Transaction tr, Tuple tenantName)
Deletes a tenant from the cluster. If the tenant does not exists, this operation will complete successfully without changing anything. The transaction must be committed for the deletion to take effect or to observe any errors.
Note: A tenant cannot be deleted if it has any data in it. To delete a non-empty tenant, you must first use a clear operation to delete all of its keys.
This is a convenience method that generates the tenant name by packing aTuple
.- Parameters:
tr
- The transaction used to delete the tenant.tenantName
- The name of the tenant being deleted, as a Tuple.
-
deleteTenant
public static java.util.concurrent.CompletableFuture<java.lang.Void> deleteTenant(Database db, byte[] tenantName)
Deletes a tenant from the cluster using a transaction created on the specifiedDatabase
. This operation will first check whether the tenant exists, and if it does not it will set theCompletableFuture
to a tenant_not_found error. Otherwise, it will attempt to delete the tenant in a retry loop. If the tenant is deleted concurrently by another transaction, this function may still return successfully.
Note: A tenant cannot be deleted if it has any data in it. To delete a non-empty tenant, you must first use a clear operation to delete all of its keys.- Parameters:
db
- The database used to create a transaction for deleting the tenant.tenantName
- The name of the tenant being deleted.- Returns:
- a
CompletableFuture
that when set without error will indicate that the tenant has been deleted.
-
deleteTenant
public static java.util.concurrent.CompletableFuture<java.lang.Void> deleteTenant(Database db, Tuple tenantName)
Deletes a tenant from the cluster using a transaction created on the specifiedDatabase
. This operation will first check whether the tenant exists, and if it does not it will set theCompletableFuture
to a tenant_not_found error. Otherwise, it will attempt to delete the tenant in a retry loop. If the tenant is deleted concurrently by another transaction, this function may still return successfully.
Note: A tenant cannot be deleted if it has any data in it. To delete a non-empty tenant, you must first use a clear operation to delete all of its keys.
This is a convenience method that generates the tenant name by packing aTuple
.- Parameters:
db
- The database used to create a transaction for deleting the tenant.tenantName
- The name of the tenant being deleted.- Returns:
- a
CompletableFuture
that when set without error will indicate that the tenant has been deleted.
-
-