Documentation
¶
Index ¶
Constants ¶
const ( LogFilePrefix = "vic-machine" // logFilePrefix is the prefix for file names of all vic-machine log files LogFileSuffix = ".log" // logFileSuffix is the suffix for file names of all vic-machine log files )
Reminder: When changing these, consider the impact to backwards compatibility.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferedPipe ¶
type BufferedPipe struct {
// contains filtered or unexported fields
}
BufferedPipe struct implements a pipe readwriter with buffer
func NewBufferedPipe ¶
func NewBufferedPipe() *BufferedPipe
NewBufferedPipe returns a new buffered pipe instance the internal buffer is initialized to default size. Since internal memory is used, need to make sure that buffered data is bounded.
func (*BufferedPipe) Read ¶
func (bp *BufferedPipe) Read(data []byte) (n int, err error)
Read is blocked until a writer in the queue is done writing (until data is available)
func (*BufferedPipe) Write ¶
func (bp *BufferedPipe) Write(data []byte) (n int, err error)
Write writes to the internal buffer, and signals one of the reader in queue to start reading.
type DatastoreReadySignal ¶
type DatastoreReadySignal struct {
// Datastore: the govmomi datastore object
Datastore *object.Datastore
// Name: vic-machine process name (e.g. "create", "inspect")
Name string
// Operation: the operation from which the signal is sent
Operation trace.Operation
// VMPathName: the datastore path
VMPathName string
// Timestamp: timestamp at which the signal is sent
Timestamp time.Time
}
DatastoreReadySignal serves as a signal struct indicating datastore folder path is available
type Receiver ¶
type Receiver interface {
Signal(sig DatastoreReadySignal)
}
type VCHLogger ¶
type VCHLogger struct {
// contains filtered or unexported fields
}
func New ¶
func New() *VCHLogger
New creates the logger, with the streaming pipe and singaling channel.
func (*VCHLogger) Close ¶
Close stops the logger by closing the underlying pipe
func (*VCHLogger) GetPipe ¶
func (l *VCHLogger) GetPipe() *BufferedPipe
GetPipe returns the streaming pipe of the vch logger
func (*VCHLogger) Run ¶
func (l *VCHLogger) Run()
Run waits until the signal arrives and uploads the streaming pipe to datastore
func (*VCHLogger) Signal ¶
func (l *VCHLogger) Signal(sig DatastoreReadySignal)
Signal signals the logger that the datastore folder is ready
Source Files
¶
- buffered_pipe.go
- vchlogger.go