New methods and properties needed

Diskussions related to the development of PhpLogCon

Google Ads


New methods and properties needed

Postby alorbach » 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.
alorbach
Site Admin
 
Posts: 1627
Joined: Thu Feb 13, 2003 11:55 am

Urgent Question?

  • Pulling out your Hair?
  • Wasting Time and Money?
  • Deadline Approaching?

Postby mmeckelein » 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: 176
Joined: Wed Mar 12, 2003 12:07 pm

RE: New methods and properties needed

Postby rgerhards » 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
rgerhards
Site Admin
 
Posts: 3806
Joined: Thu Feb 13, 2003 11:57 am

RE: New methods and properties needed

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

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

RE: New methods and properties needed

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

I will implement this into logstream as suggested.
mmeckelein
Adiscon Support
 
Posts: 176
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