2013-12-17 14:41:30 +00:00
|
|
|
# Part of accounting-api project:
|
|
|
|
# https://gitorious.org/conservancy/accounting-api
|
|
|
|
# License: AGPLv3-or-later
|
|
|
|
|
2013-12-17 10:14:45 +00:00
|
|
|
from abc import ABCMeta, abstractmethod
|
2013-12-14 15:08:47 +00:00
|
|
|
|
2013-12-18 21:02:03 +00:00
|
|
|
|
|
|
|
class Storage:
|
2013-12-14 15:08:47 +00:00
|
|
|
'''
|
|
|
|
ABC for accounting storage
|
|
|
|
'''
|
2013-12-17 10:14:45 +00:00
|
|
|
__metaclass__ = ABCMeta
|
|
|
|
|
2013-12-14 15:08:47 +00:00
|
|
|
def __init__(self, *args, **kw):
|
2013-12-17 10:14:45 +00:00
|
|
|
pass
|
2013-12-14 15:08:47 +00:00
|
|
|
|
2013-12-17 10:14:45 +00:00
|
|
|
@abstractmethod
|
2013-12-14 15:08:47 +00:00
|
|
|
def get_transactions(self, *args, **kw):
|
2013-12-17 10:14:45 +00:00
|
|
|
raise NotImplementedError
|
2013-12-14 15:08:47 +00:00
|
|
|
|
2013-12-17 10:14:45 +00:00
|
|
|
@abstractmethod
|
2013-12-14 15:08:47 +00:00
|
|
|
def get_transaction(self, *args, **kw):
|
2013-12-17 10:14:45 +00:00
|
|
|
raise NotImplementedError
|
2013-12-14 15:08:47 +00:00
|
|
|
|
2013-12-17 10:14:45 +00:00
|
|
|
@abstractmethod
|
2013-12-14 15:08:47 +00:00
|
|
|
def get_account(self, *args, **kw):
|
2013-12-17 10:14:45 +00:00
|
|
|
raise NotImplementedError
|
2013-12-14 15:08:47 +00:00
|
|
|
|
2013-12-17 10:14:45 +00:00
|
|
|
@abstractmethod
|
2013-12-14 15:08:47 +00:00
|
|
|
def get_accounts(self, *args, **kw):
|
2013-12-17 10:14:45 +00:00
|
|
|
raise NotImplementedError
|
|
|
|
|
2013-12-17 13:11:29 +00:00
|
|
|
@abstractmethod
|
|
|
|
def add_transaction(self, transaction):
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2013-12-17 10:14:45 +00:00
|
|
|
@abstractmethod
|
|
|
|
def update_transaction(self, transaction):
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2013-12-18 21:02:03 +00:00
|
|
|
@abstractmethod
|
|
|
|
def delete_transaction(self, transaction_id):
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2013-12-17 10:14:45 +00:00
|
|
|
@abstractmethod
|
|
|
|
def reverse_transaction(self, transaction_id):
|
|
|
|
raise NotImplementedError
|