I handle transactions for an efficient database of logfile entries.

Instance Variable ipm An instance of sift.IPMatcher containing all IP addresses in the database.
Instance Variable dtk An instance of DTK loaded (eventually) with all datetime values in the database.
Method startup Undocumented
Method preload Loads my DTK object from the database. Returns a Deferred that fires with the number of IPs in the database.
Method setRecord Adds all needed database entries for the supplied record at the specified datetime.
Method getRecords Returns a (deferred) list of all the records for the specified datetime, in the order they were originally written.
Method purgeIP Purges the database of entries with the specified IP address, returning the (deferred) number of rows that were matched and presumably deleted.
Method hitsForIP Returns the number of entries for the specified IP address
Method fileInfo No summary
Method insertEntry Inserts a DB entry for the specified datetime, using the supplied dict of values, which are index integers for indexed values.
Method setEntry Adds a new entry to the database for the specified datetime dt. See my colNames attribute for the six values you need to supply.
Method matchingEntry No summary
Method getEntries Returns the ID plus all of the columns after dt for one datetime second of entries.
Method setNameValue Get the unique ID for this value in the named table, adding a new entry for it there if necessary.
Method _getValuesFromIDs Call with a list of IDs, one for each of my indexedValues, and returns a dict with the name:value items.

Inherited from Base:

Class Method linger Undocumented
Method myDir 0 Undocumented
Method myDir 1 Undocumented
Method myDir Undocumented
Static Method dtFormat Undocumented
Static Method deferToDelay Undocumented
Method msgHeading No summary
Method msgBody Send a new line of message body to the last heading for this instance, or the instance whose ID is specified via the keyword ID.
Method msgOrphan Undocumented
Method msgWarning Undocumented
Method msgError Undocumented
Method msgProgress Undocumented
Method fileStatus Undocumented
Method fileProgress Undocumented
Method csvTextToList Undocumented
Static Method checkPath Undocumented
Static Method dirOfPath Undocumented
Method filesInDir No summary
Method pathInDir Returns the absolute path of a file in my directory
Method cleak No summary
Method gleak Undocumented
ipm =
An instance of sift.IPMatcher containing all IP addresses in the database.
dtk =
An instance of DTK loaded (eventually) with all datetime values in the database.
@defer.inlineCallbacks
def startup(self):
Undocumented
def preload(self, progressCall=None, N_batch=10, N_progress=100):

Loads my DTK object from the database. Returns a Deferred that fires with the number of IPs in the database.

You can use the DTK object via dtk in the meantime; doing so will save you more and more time as the entries load from the database.

@wait
@defer.inlineCallbacks
def setRecord(self, dt, record):

Adds all needed database entries for the supplied record at the specified datetime.

ReturnsA Deferred that fires with a bool indicating if a new entry was added.
@wait
def getRecords(self, dt):

Returns a (deferred) list of all the records for the specified datetime, in the order they were originally written.

Note: This method requires DB connection pooling.

@transact
def purgeIP(self, ip, ignoreIPM=False):

Purges the database of entries with the specified IP address, returning the (deferred) number of rows that were matched and presumably deleted.

@transact
def hitsForIP(self, ip):

Returns the number of entries for the specified IP address

@transact
def fileInfo(self, fileName, *args):

With just fileName as an argument, returns the datetime and number of records for the file, if one was processed previously and its results are fully reflected in the DB, or None

With three additional arguments of a datetime object, an integer file size (in bytes), and an integer number of records, the method updates or inserts an entry for the file to indicate that it has been processed and its results are fully reflected in the DB.

@transact
def insertEntry(self, dt, values):

Inserts a DB entry for the specified datetime, using the supplied dict of values, which are index integers for indexed values.

You must ensure that there is one value for each name defined in colNames.

Returns a unique integer ID for the new entry.

@defer.inlineCallbacks
def setEntry(self, dt, values):

Adds a new entry to the database for the specified datetime dt. See my colNames attribute for the six values you need to supply.

Returns a deferred that fires with a Bool indicating if a new entry was added

@defer.inlineCallbacks
def matchingEntry(self, dt, values):

Returns a deferred that fires with the integer ID of the DB entry for the specified datetime and list of values (in the order of the colNames list, some values being integer indices), or None if there is no such entry.

@transact
def getEntries(self, dt):

Returns the ID plus all of the columns after dt for one datetime second of entries.

@transact
def setNameValue(self, name, value):

Get the unique ID for this value in the named table, adding a new entry for it there if necessary.

@transact
def _getValuesFromIDs(self, IDs):

Call with a list of IDs, one for each of my indexedValues, and returns a dict with the name:value items.

API Documentation for logalyzer, generated by pydoctor at 2021-09-18 08:41:09.