gonk.core.events
- class gonk.core.events.ActionT(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Enum for object and annotation event actions.
- CREATE = 1
Create event.
- UPDATE = 2
Update event.
- DELETE = 4
Delete event.
- class gonk.core.events.DecisionT(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Enum for review event decisions.
- ACCEPT = 1
Event accepted.
- REJECT = 2
Event rejected.
- class gonk.core.events.OwnerActionT(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Enum for owner event actions.
- ADD = 1
Owner added.
- REMOVE = 2
Owner removed.
- class gonk.core.events.HashTypeT(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Enum for object and annotation hash types.
- SHA256 = 1
SHA256 hash is best hash.
- class gonk.core.events.Identifier(uuid_: UUID, version: int)
Identifies objects and annotations with a UUID and version number.
- uuid: UUID
Object or annotation’s UUID.
- version: int
Object or annotation’s version.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.Object(name: str, format_: str, size: int, hash_type: HashTypeT, hash_: str, uuid_: UUID | None = None, version: int = 0)
Metadata container for an object in the
gonk.core.interfaces.Depot.- uuid: UUID
Object’s UUID.
- version: int
Object’s version.
- name: str
Object’s filename.
- format: str
Object’s mimetype.
- size: int
Object size in bytes.
- hash: str
Hex encoded hash of the object.
- identifier() Identifier
Return the object identifier.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.Annotation(schema_: Identifier, size: int, hash_type: HashTypeT, hash_: str, uuid_: UUID | None = None, version: int = 0)
Metadata container for an annotation in the
gonk.core.interfaces.Depot.- uuid: UUID
Annotation’s UUID.
- version: int
Annotation’s version.
- schema_: Identifier
Schema identifier.
- size: int
Annotation size in bytes.
- hash: str
Hex encoded hash.
- identifier() Identifier
Return the identifier for this annotation.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.Event(uuid_: UUID | None = None, timestamp: str | None = None, integrity: bytes | None = None, author: str | None = None)
Parent class for all event types.
- uuid: UUID
Event’s UUID.
- timestamp: str
Event’s timestamp.
- integrity: bytes | None
Byte field for hashes or signatures.
- author: str | None
String field for the event’s author.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.ObjectEvent(action: ActionT, uuid_: UUID | None = None, timestamp: str | None = None, integrity: bytes | None = None, author: str | None = None)
Parent class for object-specific events (create, delete, update).
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.ObjectCreateEvent(object_: Object, uuid_: UUID | None = None, timestamp: str | None = None, integrity: bytes | None = None, author: str | None = None)
Event used for object creation.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.ObjectUpdateEvent(object_: Object, uuid_: UUID | None = None, timestamp: str | None = None, integrity: bytes | None = None, author: str | None = None)
Event used for object updates.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.ObjectDeleteEvent(object_identifier: Identifier, uuid_: UUID | None = None, timestamp: str | None = None, integrity: bytes | None = None, author: str | None = None)
Event used for object deletion.
- object_identifier: Identifier
The deleted
Object’sIdentifier.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.AnnotationEvent(action: ActionT, uuid_: UUID | None = None, timestamp: str | None = None, integrity: bytes | None = None, author: str | None = None)
Parent class for annotation-specific events (create, update, delete).
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.AnnotationCreateEvent(object_identifiers: list[Identifier], annotation: Annotation, uuid_: UUID | None = None, timestamp: str | None = None, integrity: bytes | None = None, author: str | None = None)
Event used for creating an annotation.
- object_identifiers: list[Identifier]
Object
Identifiers that this annotation references.
- annotation: Annotation
The
Annotationbeing created.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.AnnotationUpdateEvent(annotation: Annotation, uuid_: UUID | None = None, timestamp: str | None = None, integrity: bytes | None = None, author: str | None = None)
Event used for updating an annotation.
- annotation
The
Annotationbeing updated.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.AnnotationDeleteEvent(annotation_identifier: Identifier, uuid_: UUID | None = None, timestamp: str | None = None, integrity: bytes | None = None, author: str | None = None)
Event used for deleting an annotation.
- annotation_identifier: Identifier
The
Identifierof the annotation being deleted.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.ReviewEvent(decision: DecisionT, uuid_: UUID | None = None, timestamp: str | None = None, integrity: bytes | None = None, author: str | None = None)
Parent class for review events.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.ReviewAcceptEvent(event_uuid: UUID, uuid_: UUID | None = None, timestamp: str | None = None, integrity: bytes | None = None, author: str | None = None)
Event used for accepting pending object and annotation events.
- event_uuid: UUID
The change being accepted.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.ReviewRejectEvent(event_uuid: UUID, uuid_: UUID | None = None, timestamp: str | None = None, integrity: bytes | None = None, author: str | None = None)
Event used for rejecting pending object and annotation events.
- event_uuid: UUID
The change being rejected.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.
- class gonk.core.events.OwnerEvent(owner: str, owner_action: OwnerActionT, uuid_: UUID | None = None, timestamp: str | None = None, integrity: bytes | None = None, author: str | None = None)
Parent class for owner events.
- owner: str
The owner affected.
- owner_action: OwnerActionT
Whether the owner is being added or removed.
- signature_bytes() bytes
Return a byte-based representation for signing or hashing.
- serialize() dict
Serialize instance to dictionary.
- classmethod deserialize(data: dict) Self
Deserialize dictionary to instance.
- static schema(relative='') dict
Returns the JSON Schema for validating the serialized class.
- Parameters:
relative – A base path for nested references.