Metadata service API

class MetadataAPI(kv_host: str, kv_port: int)[source]
async close()[source]
async is_ready(timeout: float | None = None, pause: float = 0.5)[source]
async new_superuser(username: str, password: str, dataset_name: str)[source]
async new_account(username: str, password: str)[source]

Registers a new account

Creates a new account. Checks that the username is not registered.

Parameters:
  • username – Accounts username

  • password – Accounts password

async new_dataset(username: str, password: str, dataset_name: str)[source]

Registers a new dataset

Validates the account credentials, and creates a new dataset associated to the account. It updates the account metadata to add access to the new dataset. The dataset name must bu unique.

Parameters:
  • username – Accounts username

  • password – Accounts password

  • dataset_name – Name of the new dataset. Must be unique.

Raises:

Exception('Account is not valid!') – If wrong credentials

async add_account_to_dataset(username: str, password: str, dataset_name: str, account_name: str)[source]

Allow a certain account to access a certain dataset.

The owner of a dataset can call this and add access to an arbitrary account.

async new_dataclay(dataclay_id: UUID, host: str, port: int, is_this: bool = False)[source]
async get_dataclay(dataclay_id: UUID | str) Dataclay[source]
async get_all_backends(from_backend: bool = False, **kwargs) dict[UUID, Backend][source]
async register_backend(id: UUID, host: str, port: int, dataclay_id: UUID)[source]
async delete_backend(id: UUID)[source]
async get_all_objects(filter_func: Callable[[ObjectMetadata], bool] | None = None) dict[UUID, ObjectMetadata][source]
async upsert_object(object_md: ObjectMetadata)[source]
async change_object_id(old_id: UUID, new_id: UUID)[source]
async delete_object(id: UUID)[source]
async get_object_md_by_id(object_id: UUID) ObjectMetadata[source]
async get_object_md_by_alias(alias_name: str, dataset_name: str) ObjectMetadata[source]
async new_alias(alias_name: str, dataset_name: str, object_id: UUID)[source]
async get_all_alias(dataset_name: str | None = None, object_id: UUID | None = None) dict[str, Alias][source]
async delete_alias(alias_name: str, dataset_name: str)[source]