New methods and properties needed

Diskussions related to the development of PhpLogCon

New methods and properties needed

Postby alorbach on Wed Mar 12, 2008 2:27 pm

Ok from our messenger and phone discussions, here is the list of methods and properties we may need:

class logstream

Method SkipNext();
Skips the next entry and moves one record ahead.

Method GetMessageCount();
Optional function, if possible and the lower layer allows it, return the maximum number of messages. If not returns -1.


class logstreamconfig

Property DefaultFacility
Default Syslog Facility, optional value.

Property DefaultSeverity
Default Syslog Severity, optional value.
User avatar
alorbach
Site Admin
 
Posts: 853
Joined: Thu Feb 13, 2003 11:55 am

Postby mmeckelein on Wed Mar 12, 2008 2:33 pm

There should also be a seek in the logstream. I will modify the uml and post it here as soon as it is updated for further discussion (if necessary).
mmeckelein
Adiscon Support
 
Posts: 167
Joined: Wed Mar 12, 2003 12:07 pm

RE: New methods and properties needed

Postby rgerhards on Wed Mar 12, 2008 2:36 pm

I agree, except for SkipNext, for which I think I now have a better solution. Let me introduce the new call:

seek(uid, mode, numrecs)

uid is a unique ID from where to start, ignored in all modes except UID (see below)

mode - how the seek should be performed
BOS - seek from begin stream
EOS - seek from end of stream
UID - seek from position uid (which MUST be a *valid* uid!)

numrecs
number of records to seek from this position. Use 0 to seek to the actual position, a positive value to seek the the record numrecs records forward or a negative value to seek to a position numrecs backward.

On return, uid contains the uid of the record seeked to. It is undefined if an error occured. If no error ocucrred, the next call to ReadNext() will read the record whom's uid has been returned.

Sample:

To Read the last record of a stream, do a

seek(0, EOS, 0)
ReadNext

For the first record, similarly:

seek(0, BOS, 0)
ReadNext

To skip the next, say, 49 records from the current position, you first need to know the current uid. You may have obtained it by a previous ReadNext call. Then, do

seek(uidCURR, UID, 50)
ReadNext

Note that we seeked 50 records, because the next read will return that 50th record, so we actually skipped 49.

Can we agree on that interface?

Rainer
User avatar
rgerhards
Site Admin
 
Posts: 1274
Joined: Thu Feb 13, 2003 11:57 am

RE: New methods and properties needed

Postby alorbach on Wed Mar 12, 2008 2:40 pm

Sounds good to me.
User avatar
alorbach
Site Admin
 
Posts: 853
Joined: Thu Feb 13, 2003 11:55 am

RE: New methods and properties needed

Postby mmeckelein on Wed Mar 12, 2008 4:34 pm

I will implement this into logstream as suggested.
mmeckelein
Adiscon Support
 
Posts: 167
Joined: Wed Mar 12, 2003 12:07 pm

Google Ads



Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 0 guests

cron