Documentation ¶
Overview ¶
Package logreader defines interfaces for reading log files remotely.
Index ¶
- Constants
- Variables
- type LogEntry
- type LogFileClientMethods
- type LogFileClientStub
- type LogFileReadLogClientCall
- type LogFileReadLogClientStream
- type LogFileReadLogServerCall
- type LogFileReadLogServerCallStub
- type LogFileReadLogServerStream
- type LogFileServerMethods
- type LogFileServerStub
- type LogFileServerStubMethods
Constants ¶
const AllEntries = int32(-1)
A special NumEntries value that indicates that all entries should be returned by ReadLog.
Variables ¶
var LogFileDesc rpc.InterfaceDesc = descLogFile
LogFileDesc describes the LogFile interface.
Functions ¶
This section is empty.
Types ¶
type LogEntry ¶
type LogEntry struct { // The offset (in bytes) where this entry starts. Position int64 // The content of the log entry. Line string }
LogEntry is a log entry from a log file.
func (LogEntry) VDLReflect ¶
type LogFileClientMethods ¶
type LogFileClientMethods interface { // Size returns the number of bytes in the receiving object. Size(*context.T, ...rpc.CallOpt) (int64, error) // ReadLog receives up to numEntries log entries starting at the // startPos offset (in bytes) in the receiving object. Each stream chunk // contains one log entry. // // If follow is true, ReadLog will block and wait for more entries to // arrive when it reaches the end of the file. // // ReadLog returns the position where it stopped reading, i.e. the // position where the next entry starts. This value can be used as // startPos for successive calls to ReadLog. // // The returned error will be EndOfFile if and only if ReadLog reached the // end of the file and no log entries were returned. ReadLog(_ *context.T, startPos int64, numEntries int32, follow bool, _ ...rpc.CallOpt) (LogFileReadLogClientCall, error) }
LogFileClientMethods is the client interface containing LogFile methods.
LogFile can be used to access log files remotely.
type LogFileClientStub ¶
type LogFileClientStub interface { LogFileClientMethods }
LogFileClientStub embeds LogFileClientMethods and is a placeholder for additional management operations.
func LogFileClient ¶
func LogFileClient(name string) LogFileClientStub
LogFileClient returns a client stub for LogFile.
type LogFileReadLogClientCall ¶
type LogFileReadLogClientCall interface { LogFileReadLogClientStream // Finish blocks until the server is done, and returns the positional return // values for call. // // Finish returns immediately if the call has been canceled; depending on the // timing the output could either be an error signaling cancelation, or the // valid positional return values from the server. // // Calling Finish is mandatory for releasing stream resources, unless the call // has been canceled or any of the other methods return an error. Finish should // be called at most once. Finish() (int64, error) }
LogFileReadLogClientCall represents the call returned from LogFile.ReadLog.
type LogFileReadLogClientStream ¶
type LogFileReadLogClientStream interface { // RecvStream returns the receiver side of the LogFile.ReadLog client stream. RecvStream() interface { // Advance stages an item so that it may be retrieved via Value. Returns // true iff there is an item to retrieve. Advance must be called before // Value is called. May block if an item is not available. Advance() bool // Value returns the item that was staged by Advance. May panic if Advance // returned false or was not called. Never blocks. Value() LogEntry // Err returns any error encountered by Advance. Never blocks. Err() error } }
LogFileReadLogClientStream is the client stream for LogFile.ReadLog.
type LogFileReadLogServerCall ¶
type LogFileReadLogServerCall interface { rpc.ServerCall LogFileReadLogServerStream }
LogFileReadLogServerCall represents the context passed to LogFile.ReadLog.
type LogFileReadLogServerCallStub ¶
type LogFileReadLogServerCallStub struct {
rpc.StreamServerCall
}
LogFileReadLogServerCallStub is a wrapper that converts rpc.StreamServerCall into a typesafe stub that implements LogFileReadLogServerCall.
func (*LogFileReadLogServerCallStub) Init ¶
func (s *LogFileReadLogServerCallStub) Init(call rpc.StreamServerCall)
Init initializes LogFileReadLogServerCallStub from rpc.StreamServerCall.
func (*LogFileReadLogServerCallStub) SendStream ¶
func (s *LogFileReadLogServerCallStub) SendStream() interface { Send(item LogEntry) error }
SendStream returns the send side of the LogFile.ReadLog server stream.
type LogFileReadLogServerStream ¶
type LogFileReadLogServerStream interface { // SendStream returns the send side of the LogFile.ReadLog server stream. SendStream() interface { // Send places the item onto the output stream. Returns errors encountered // while sending. Blocks if there is no buffer space; will unblock when // buffer space is available. Send(item LogEntry) error } }
LogFileReadLogServerStream is the server stream for LogFile.ReadLog.
type LogFileServerMethods ¶
type LogFileServerMethods interface { // Size returns the number of bytes in the receiving object. Size(*context.T, rpc.ServerCall) (int64, error) // ReadLog receives up to numEntries log entries starting at the // startPos offset (in bytes) in the receiving object. Each stream chunk // contains one log entry. // // If follow is true, ReadLog will block and wait for more entries to // arrive when it reaches the end of the file. // // ReadLog returns the position where it stopped reading, i.e. the // position where the next entry starts. This value can be used as // startPos for successive calls to ReadLog. // // The returned error will be EndOfFile if and only if ReadLog reached the // end of the file and no log entries were returned. ReadLog(_ *context.T, _ LogFileReadLogServerCall, startPos int64, numEntries int32, follow bool) (int64, error) }
LogFileServerMethods is the interface a server writer implements for LogFile.
LogFile can be used to access log files remotely.
type LogFileServerStub ¶
type LogFileServerStub interface { LogFileServerStubMethods // DescribeInterfaces the LogFile interfaces. Describe__() []rpc.InterfaceDesc }
LogFileServerStub adds universal methods to LogFileServerStubMethods.
func LogFileServer ¶
func LogFileServer(impl LogFileServerMethods) LogFileServerStub
LogFileServer returns a server stub for LogFile. It converts an implementation of LogFileServerMethods into an object that may be used by rpc.Server.
type LogFileServerStubMethods ¶
type LogFileServerStubMethods interface { // Size returns the number of bytes in the receiving object. Size(*context.T, rpc.ServerCall) (int64, error) // ReadLog receives up to numEntries log entries starting at the // startPos offset (in bytes) in the receiving object. Each stream chunk // contains one log entry. // // If follow is true, ReadLog will block and wait for more entries to // arrive when it reaches the end of the file. // // ReadLog returns the position where it stopped reading, i.e. the // position where the next entry starts. This value can be used as // startPos for successive calls to ReadLog. // // The returned error will be EndOfFile if and only if ReadLog reached the // end of the file and no log entries were returned. ReadLog(_ *context.T, _ *LogFileReadLogServerCallStub, startPos int64, numEntries int32, follow bool) (int64, error) }
LogFileServerStubMethods is the server interface containing LogFile methods, as expected by rpc.Server. The only difference between this interface and LogFileServerMethods is the streaming methods.