Package gofer :: Package rmi :: Module async :: Class Journal
[hide private]
[frames] | no frames]

Class Journal

source code

Async message journal

Instance Methods [hide private]
 
__init__(self, root='/tmp/gofer/journal/watchdog') source code
dict
load(self)
Load all journal entries.
source code
 
write(self, sn, replyto, any, ts)
Write a new journal entry.
source code
Entry
update(self, sn, **property)
Update a journal entry for the specified sn.
source code
 
delete(self, sn)
Delete a journal entry by serial number.
source code
Entry
find(self, sn)
Find a journal entry my serial number.
source code
str
__fn(self, sn)
File name.
source code
Entry
__read(self, path)
Read the journal file at the specified path.
source code
 
__write(self, je)
Write the specified journal entry.
source code
 
__unlink(self, path)
Unlink (delete) the journal file at the specified path.
source code
 
__mkdir(self)
Ensure the directory exists.
source code
Class Variables [hide private]
str Entry:
  • sn: serial number
  • replyto: reply to amqp address.
  • any: user data
  • timeout: (start<ctime>, complete<ctime>)
  • idx: current timeout index.
ROOT = '/tmp/gofer/journal/watchdog'
The default journal directory root.
Instance Variables [hide private]
str root
The root journal directory.
Method Details [hide private]

__init__(self, root='/tmp/gofer/journal/watchdog')
(Constructor)

source code 
Parameters:
  • root (str) - A journal root directory path.

load(self)

source code 

Load all journal entries.

Returns: dict
A dict of journal entries.

write(self, sn, replyto, any, ts)

source code 

Write a new journal entry.

Parameters:
  • sn (str) - A serial number.
  • replyto (str) - An AMQP address.
  • any (any) - User defined data.
  • ts (tuple(2)) - A timeout (start<ctime>,complete<ctime>)

update(self, sn, **property)

source code 

Update a journal entry for the specified sn.

Parameters:
  • sn (str) - An entry serial number.
  • property (dict) - properties to update.
Returns: Entry
The updated journal entry
Raises:
  • KeyError - On invalid key.

delete(self, sn)

source code 

Delete a journal entry by serial number.

Parameters:
  • sn (str) - An entry serial number.

find(self, sn)

source code 

Find a journal entry my serial number.

Parameters:
  • sn (str) - An entry serial number.
Returns: Entry
The journal entry.

__fn(self, sn)

source code 

File name.

Parameters:
  • sn (str) - An entry serial number.
Returns: str
The journal file name by serial number.

__read(self, path)

source code 

Read the journal file at the specified path.

Parameters:
  • path (str) - A journal file path.
Returns: Entry
A journal entry.

__write(self, je)

source code 

Write the specified journal entry.

Parameters:
  • je (Entry) - A journal entry

__unlink(self, path)

source code 

Unlink (delete) the journal file at the specified path.

Parameters:
  • path (str) - A journal file path.