vchlog

package
v1.4.3-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
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) Close

func (bp *BufferedPipe) Close() (err error)

Close closes the pipe

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

func (l *VCHLogger) Close() error

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

func (*VCHLogger) Wait

func (l *VCHLogger) Wait(op trace.Operation)

Wait waits for the streaming to VCH datastore to finish, or context times out

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL