oc_ocdm.counter_handler.counter_handler module

class oc_ocdm.counter_handler.counter_handler.CounterHandler[source]

Bases: abc.ABC

Abstract class representing the interface for every concrete counter handler.

abstract set_counter(new_value, entity_short_name, prov_short_name='', identifier=1)[source]

Method signature for concrete implementations that allow setting the counter value of graph and provenance entities.

Parameters
  • new_value (int) – The new counter value to be set

  • entity_short_name (str) – The short name associated either to the type of the entity itself or, in case of a provenance entity, to the type of the relative graph entity.

  • prov_short_name (str) – In case of a provenance entity, the short name associated to the type of the entity itself. An empty string otherwise.

  • identifier (int) – In case of a provenance entity, the counter value that identifies the relative graph entity. The integer value ‘1’ otherwise.

Raises

NotImplementedError – always

Returns

None

Return type

None

abstract read_counter(entity_short_name, prov_short_name='', identifier=1)[source]

Method signature for concrete implementations that allow reading the counter value of graph and provenance entities.

Parameters
  • entity_short_name (str) – The short name associated either to the type of the entity itself or, in case of a provenance entity, to the type of the relative graph entity.

  • prov_short_name (str) – In case of a provenance entity, the short name associated to the type of the entity itself. An empty string otherwise.

  • identifier (int) – In case of a provenance entity, the counter value that identifies the relative graph entity. The integer value ‘1’ otherwise.

Raises

NotImplementedError – always

Returns

The requested counter value.

Return type

int

abstract increment_counter(entity_short_name, prov_short_name='', identifier=1)[source]

Method signature for concrete implementations that allow incrementing by one unit the counter value of graph and provenance entities.

Parameters
  • entity_short_name (str) – The short name associated either to the type of the entity itself or, in case of a provenance entity, to the type of the relative graph entity.

  • prov_short_name (str) – In case of a provenance entity, the short name associated to the type of the entity itself. An empty string otherwise.

  • identifier (int) – In case of a provenance entity, the counter value that identifies the relative graph entity. The integer value ‘1’ otherwise.

Raises

NotImplementedError – always

Returns

The newly-updated (already incremented) counter value.

Return type

int

abstract set_metadata_counter(new_value, entity_short_name, dataset_name)[source]

Method signature for concrete implementations that allow setting the counter value of metadata entities.

Parameters
  • new_value (int) – The new counter value to be set

  • entity_short_name (str) – The short name associated either to the type of the entity itself.

  • dataset_name (str) – In case of a Dataset, its name. Otherwise, the name of the relative dataset.

Raises

NotImplementedError – always

Returns

None

Return type

None

abstract read_metadata_counter(entity_short_name, dataset_name)[source]

Method signature for concrete implementations that allow reading the counter value of metadata entities.

Parameters
  • entity_short_name (str) – The short name associated either to the type of the entity itself.

  • dataset_name (str) – In case of a Dataset, its name. Otherwise, the name of the relative dataset.

Raises

NotImplementedError – always

Returns

The requested counter value.

Return type

int

abstract increment_metadata_counter(entity_short_name, dataset_name)[source]

Method signature for concrete implementations that allow incrementing by one unit the counter value of metadata entities.

Parameters
  • entity_short_name (str) – The short name associated either to the type of the entity itself.

  • dataset_name (str) – In case of a Dataset, its name. Otherwise, the name of the relative dataset.

Raises

NotImplementedError – always

Returns

The newly-updated (already incremented) counter value.

Return type

int