Documentation ¶
Index ¶
- Constants
- Variables
- func FilePath(log *v1alpha2.Log) (string, error)
- func FormatName(parent, name string) string
- func ParseName(raw string) (parent, result, name string, err error)
- func ToStorage(record *pb.Record, config *config.Config) ([]byte, error)
- type Stream
- func NewFileStream(ctx context.Context, log *v1alpha2.Log, config *config.Config) (Stream, error)
- func NewGCSStream(ctx context.Context, log *v1alpha2.Log, config *server.Config) (Stream, error)
- func NewS3Stream(ctx context.Context, log *v1alpha2.Log, config *server.Config) (Stream, error)
- func NewStream(ctx context.Context, log *v1alpha2.Log, config *config.Config) (Stream, error)
- func ToStream(ctx context.Context, record *db.Record, config *config.Config) (Stream, *v1alpha2.Log, error)
Constants ¶
const ( // DefaultBufferSize is the default buffer size. This based on the recommended // gRPC message size for streamed content, which ranges from 16 to 64 KiB. Choosing 32 KiB as a // middle ground between the two. DefaultBufferSize = 32 * 1024 )
Variables ¶
var ( // NameRegex matches valid name specs for a Result. NameRegex = regexp.MustCompile("(^[a-z0-9_-]{1,63})/results/([a-z0-9_-]{1,63})/logs/([a-z0-9_-]{1,63}$)") )
Functions ¶
func FilePath ¶
FilePath returns file path to store log. This file path can be path in the real file system or virtual value depending on storage type.
func FormatName ¶
FormatName takes in a parent ("a/results/b") and record name ("c") and returns the full resource name ("a/results/b/logs/c").
Types ¶
type Stream ¶
Stream is an interface that defines the behavior of a streaming log service.
func NewFileStream ¶
NewFileStream returns a LogStreamer that streams directly from a log file on local disk.
func NewGCSStream ¶ added in v0.8.0
NewGCSStream returns a log streamer for the GCS storage type.
func NewS3Stream ¶
NewS3Stream returns a log streamer for the S3 log storage type.
func NewStream ¶
NewStream returns a LogStreamer for the given Log. LogStreamers do the following:
1. Write log data from their respective source to an io.Writer interface. 2. Read log data from a source, and store it in the respective backend if that behavior is supported.
All LogStreamers support writing log data to an io.Writer from the provided source. LogStreamers do not need to receive and store data from the provided source.
NewStream may mutate the Log object's status, to provide implementation information for reading and writing files.