Coverage for rdflib_ocdm / counter_handler / counter_handler.py: 100%
1 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-21 12:35 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-21 12:35 +0000
1#!/usr/bin/python
3# SPDX-FileCopyrightText: 2016 Silvio Peroni <essepuntato@gmail.com>
4# SPDX-FileCopyrightText: 2023-2025 Arcangelo Massari <arcangelo.massari@unibo.it>
5#
6# SPDX-License-Identifier: ISC
7from abc import ABC, abstractmethod
10class CounterHandler(ABC): # pragma: no cover
11 """Abstract class representing the interface for every concrete counter handler."""
13 @abstractmethod
14 def set_counter(self, new_value: int, entity_name: str) -> None:
15 """
16 Method signature for concrete implementations that allow setting the counter value
17 of provenance entities.
19 :param new_value: The new counter value to be set
20 :type new_value: int
21 :param entity_name: The entity name
22 :type entity_name: str
23 :raises NotImplementedError: always
24 :return: None
25 """
26 raise NotImplementedError
28 @abstractmethod
29 def read_counter(self, entity_name: str) -> int:
30 """
31 Method signature for concrete implementations that allow reading the counter value
32 of graph and provenance entities.
34 :param entity_name: The entity name
35 :type entity_name: str
36 :raises NotImplementedError: always
37 :return: The requested counter value.
38 """
39 raise NotImplementedError
41 @abstractmethod
42 def increment_counter(self, entity_name: str) -> int:
43 """
44 Method signature for concrete implementations that allow incrementing by one unit
45 the counter value of graph and provenance entities.
47 :param entity_name: The entity name
48 :type entity_name: str
49 :raises NotImplementedError: always
50 :return: The newly-updated (already incremented) counter value.
51 """
52 raise NotImplementedError