You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.9 KiB
61 lines
1.9 KiB
# Copyright (C) 2005-2025 Splunk Inc. All Rights Reserved.
|
|
|
|
class EntryType(object):
|
|
"""Namespace of various types of entries found in a journal."""
|
|
|
|
DUPLICATE_OBJECT = 'DUPLICATE_OBJECT'
|
|
ERROR_BULK_UPDATE_PERMS = 'ERROR_BULK_UPDATE_PERMS'
|
|
ERROR_IMAGE_READ = 'ERROR_IMAGE_READ'
|
|
ERROR_IMAGE_ENCODE = 'ERROR_IMAGE_ENCODE'
|
|
ERROR_OBJECT_READ = 'ERROR_OBJECT_READ'
|
|
ERROR_OBJECTS_SAVE = 'ERROR_OBJECTS_SAVE'
|
|
INVALID_CONTENT_TYPE = 'INVALID_CONTENT_TYPE'
|
|
INVALID_OBJECT_TYPE = 'INVALID_OBJECT_TYPE'
|
|
OBJECT_ALREADY_EXISTS = 'OBJECT_ALREADY_EXISTS'
|
|
OBJECT_NAME_ALREADY_EXISTS = 'OBJECT_NAME_ALREADY_EXISTS'
|
|
SKIPPING_INSTALLATION_PROCESSING = 'SKIPPING_INSTALLATION_PROCESSING'
|
|
SKIPPING_INSTALLATION_WRITING = 'SKIPPING_INSTALLATION_WRITING'
|
|
SUCCESS_OBJECTS_SAVE = 'SUCCESS_OBJECTS_SAVE'
|
|
UNSUPPORTED_CONTENT_TYPE = 'UNSUPPORTED_CONTENT_TYPE'
|
|
|
|
|
|
class TransactionJournal(dict):
|
|
"""Records success and failure events during the course of a transaction."""
|
|
|
|
FAILURE = 'failure'
|
|
SUCCESS = 'success'
|
|
|
|
def failure(self, entry=None):
|
|
"""
|
|
If supplied, this method records a failure entry of the transaction.
|
|
|
|
Returns the failure entries of the transaction.
|
|
|
|
:param entry: an entry object
|
|
:type entry: object
|
|
|
|
:return: the failure entries of the transaction
|
|
:rtype: list
|
|
"""
|
|
obj = self.setdefault(self.FAILURE, [])
|
|
if entry:
|
|
obj.append(entry)
|
|
return obj
|
|
|
|
def success(self, entry=None):
|
|
"""
|
|
If supplied, this method records a success entry of the transaction.
|
|
|
|
Returns the success entries of the transaction.
|
|
|
|
:param entry: an entry object
|
|
:type entry: object
|
|
|
|
:return: the success entries of the transaction
|
|
:rtype: list
|
|
"""
|
|
obj = self.setdefault(self.SUCCESS, [])
|
|
if entry:
|
|
obj.append(entry)
|
|
return obj
|