graviti.manager.permission#

The implementation of the dataset object permission.

Module Contents#

Classes#

ObjectPermissionManager

The basic structure of the object permission of the dataset.

OSSObjectPermissionManager

The basic structure of the object permission of the dataset stored in OSS.

AZUREObjectPermissionManager

The basic structure of the object permission of the dataset stored in AZURE.

S3ObjectPermissionManager

The basic structure of the object permission of the dataset stored in S3.

class graviti.manager.permission.ObjectPermissionManager(dataset)[source]#

The basic structure of the object permission of the dataset.

Parameters

dataset (graviti.manager.Dataset) – Class Dataset instance.

property prefix(self)[source]#

Return the prefix of the put permission.

Returns

The prefix of the put permission.

Return type

str

abstract get_object(self, key, _allow_retry=True)[source]#

Get the object from graviti.

Parameters
  • key (str) – The key of the file.

  • _allow_retry (bool) – Whether requesting the get permission again is allowed.

Raises

NotImplementedError – The method of the base class should not be called.

Return type

graviti.utility.UserResponse

abstract put_object(self, key, path, _allow_retry=True)[source]#

Put the object to OSS.

Parameters
  • key (str) – The key of the file.

  • path (pathlib.Path) – The path of the file.

  • _allow_retry (bool) – Whether requesting the put permission again is allowed.

Raises

NotImplementedError – The method of the base class should not be called.

Return type

None

class graviti.manager.permission.OSSObjectPermissionManager(dataset)[source]#

Bases: ObjectPermissionManager

The basic structure of the object permission of the dataset stored in OSS.

Parameters

dataset (graviti.manager.Dataset) –

get_object(self, key, _allow_retry=True)[source]#

Get the object from OSS.

Parameters
  • key (str) – The key of the file.

  • _allow_retry (bool) – Whether requesting the get permission again is allowed.

Raises

ResponseError – If post response error.

Returns

The response of OSS get object API.

Return type

graviti.utility.UserResponse

put_object(self, key, path, _allow_retry=True)[source]#

Put the object to OSS.

Parameters
  • key (str) – The key of the file.

  • path (pathlib.Path) – The path of the file.

  • _allow_retry (bool) – Whether requesting the put permission again is allowed.

Raises

ResponseError – If post response error.

Return type

None

class graviti.manager.permission.AZUREObjectPermissionManager(dataset)[source]#

Bases: ObjectPermissionManager

The basic structure of the object permission of the dataset stored in AZURE.

Parameters

dataset (graviti.manager.Dataset) –

get_object(self, key, _allow_retry=True)[source]#

Get the object from AZURE.

Parameters
  • key (str) – The key of the file.

  • _allow_retry (bool) – Whether requesting the get permission again is allowed.

Raises

ResponseError – If post response error.

Returns

The response of AZURE get object API.

Return type

graviti.utility.UserResponse

put_object(self, key, path, _allow_retry=True)[source]#

Put the object to AZURE.

Parameters
  • key (str) – The key of the file.

  • path (pathlib.Path) – The path of the file.

  • _allow_retry (bool) – Whether requesting the put permission again is allowed.

Raises

ResponseError – If post response error.

Return type

None

class graviti.manager.permission.S3ObjectPermissionManager(dataset)[source]#

Bases: ObjectPermissionManager

The basic structure of the object permission of the dataset stored in S3.

Parameters

dataset (graviti.manager.Dataset) –

get_object(self, key, _allow_retry=True)[source]#

Get the object from S3.

Parameters
  • key (str) – The key of the file.

  • _allow_retry (bool) – Whether requesting the get permission again is allowed.

Raises

ResponseError – If post response error.

Returns

The response of S3 get object API.

Return type

graviti.utility.UserResponse

put_object(self, key, path, _allow_retry=True)[source]#

Put the object to OSS.

Parameters
  • key (str) – The key of the file.

  • path (pathlib.Path) – The path of the file.

  • _allow_retry (bool) – Whether requesting the put permission again is allowed.

Raises

ResponseError – If post response error.

Return type

None