blob: 71e4949bc27ce27aef02bcc871bb4204a1af89a8 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package logreader defines interfaces for reading log files remotely.
package logreader
import "v.io/v23/security/access"
// LogFile can be used to access log files remotely.
type LogFile interface {
// Size returns the number of bytes in the receiving object.
Size() (int64 | error) {access.Debug}
// 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(startPos int64, numEntries int32, follow bool) stream<_, LogEntry> (int64 | error) {access.Debug}
}
// LogEntry is a log entry from a log file.
type LogEntry struct {
// The offset (in bytes) where this entry starts.
Position int64
// The content of the log entry.
Line string
}
// A special NumEntries value that indicates that all entries should be
// returned by ReadLog.
const AllEntries = int32(-1)