Documentation ¶
Overview ¶
Package cypress is a generated protocol buffer package.
It is generated from these files:
log.proto
It has these top-level messages:
Interval Attribute Tag Message StreamHeader
Index ¶
- Constants
- Variables
- func AddPlugin(name string, creator func() Plugin)
- func AllPlugins() []string
- func Available() bool
- func Close() error
- func ExpandPath(path string) string
- func GlobalFile(path string) (string, bool)
- func Glue(gen Generator, recv Receiver) error
- func GlueFiltered(gen Generator, filt Filterer, recv Receiver) error
- func LoadMergedConfig(path string, cfg *Config) error
- func LogPath() string
- func MinimumSendWindow(d time.Duration, mps int) int
- func Open()
- func ParseKVStream(in io.Reader, r Receiver) error
- func ReadCompressed(r io.Reader, comp StreamHeader_Compression) io.Reader
- func ReadUvarint(r io.Reader, buf []byte) (uint64, error)
- func StandardStreamFilter(f Filterer) error
- func UserFile(path string) (string, bool)
- func Write(m *Message) error
- func WriteCompressed(w io.WriteCloser, comp StreamHeader_Compression) io.WriteCloser
- func WriteUvarint(w io.Writer, x uint64) (int, error)
- type Attribute
- func (this *Attribute) Equal(that interface{}) bool
- func (m *Attribute) GetBoolval() bool
- func (m *Attribute) GetBval() []byte
- func (m *Attribute) GetFval() float64
- func (m *Attribute) GetIval() int64
- func (m *Attribute) GetKey() uint32
- func (m *Attribute) GetSkey() string
- func (m *Attribute) GetSval() string
- func (m *Attribute) GetTval() *Interval
- func (attr *Attribute) KVString(m *Message) string
- func (attr *Attribute) KVStringInto(m *Message, buf *bytes.Buffer)
- func (m *Attribute) Marshal() (data []byte, err error)
- func (m *Attribute) MarshalTo(data []byte) (n int, err error)
- func (*Attribute) ProtoMessage()
- func (m *Attribute) Reset()
- func (attr *Attribute) SetKey(m *Message, key string)
- func (m *Attribute) Size() (n int)
- func (m *Attribute) String() string
- func (a *Attribute) StringKey(m *Message) string
- func (m *Attribute) Unmarshal(data []byte) error
- func (attr *Attribute) Value() interface{}
- func (this *Attribute) VerboseEqual(that interface{}) error
- type BufferReceiver
- type ByteBuffer
- type Channel
- type Config
- type Connector
- type Decoder
- type Duration
- type Encoder
- type Filterer
- type FiltererPlugin
- type Flusher
- type Generator
- type GeneratorHandler
- type GeneratorHandlerFunc
- type GeneratorPlugin
- type Inter
- type Interval
- func (i *Interval) Duration() time.Duration
- func (this *Interval) Equal(that interface{}) bool
- func (m *Interval) GetNanoseconds() uint32
- func (m *Interval) GetSeconds() uint64
- func (m *Interval) Marshal() (data []byte, err error)
- func (m *Interval) MarshalTo(data []byte) (n int, err error)
- func (*Interval) ProtoMessage()
- func (m *Interval) Reset()
- func (m *Interval) Size() (n int)
- func (m *Interval) String() string
- func (m *Interval) Unmarshal(data []byte) error
- func (this *Interval) VerboseEqual(that interface{}) error
- type KVEncoder
- type KVParser
- type Logger
- type Message
- func (m *Message) Add(key string, val interface{}) error
- func (m *Message) AddBytes(key string, val []byte) error
- func (m *Message) AddDuration(key string, dur time.Duration) error
- func (m *Message) AddFloat(key string, val float64) error
- func (m *Message) AddInt(key string, val int64) error
- func (m *Message) AddInterval(key string, sec uint64, nsec uint32) error
- func (m *Message) AddMany(vals ...interface{}) error
- func (m *Message) AddString(key string, val string) error
- func (m *Message) AddTag(key string, val string)
- func (this *Message) Equal(that interface{}) bool
- func (m *Message) For(id string)
- func (m *Message) Get(key string) (interface{}, bool)
- func (m *Message) GetAttributes() []*Attribute
- func (m *Message) GetBool(key string) (bool, bool)
- func (m *Message) GetBytes(key string) ([]byte, bool)
- func (m *Message) GetFloat(key string) (float64, bool)
- func (m *Message) GetInt(key string) (int64, bool)
- func (m *Message) GetInterval(key string) (*Interval, bool)
- func (m *Message) GetSessionId() string
- func (m *Message) GetString(key string) (string, bool)
- func (m *Message) GetTag(key string) (string, bool)
- func (m *Message) GetTags() []*Tag
- func (m *Message) GetTimestamp() *tai64n.TAI64N
- func (m *Message) GetType() uint32
- func (m *Message) GetVersion() int32
- func (m *Message) HstoreAttributes() string
- func (m *Message) HstoreAttributesInto(buf *bytes.Buffer)
- func (m *Message) HstoreTags() string
- func (m *Message) HstoreTagsInto(buf *bytes.Buffer)
- func (m *Message) HumanString() string
- func (m *Message) KVPairs() string
- func (m *Message) KVPairsInto(buf *bytes.Buffer)
- func (m *Message) KVString() string
- func (m *Message) KVStringInto(buf *bytes.Buffer)
- func (m *Message) KVTagsInto(buf *bytes.Buffer)
- func (m *Message) Marshal() (data []byte, err error)
- func (m *Message) MarshalJSON() ([]byte, error)
- func (m *Message) MarshalTo(data []byte) (n int, err error)
- func (*Message) ProtoMessage()
- func (m *Message) Remove(key string) error
- func (m *Message) RemoveTag(key string) error
- func (m *Message) Reset()
- func (m *Message) SimpleJSONMap() map[string]interface{}
- func (m *Message) Size() (n int)
- func (m *Message) String() string
- func (m *Message) StringType() string
- func (m *Message) SyslogString(colorize bool, align bool) string
- func (m *Message) Unmarshal(data []byte) error
- func (m *Message) UnmarshalJSON(data []byte) error
- func (this *Message) VerboseEqual(that interface{}) error
- type MessageEncoder
- type Messages
- type Plugin
- type Probe
- type Receiver
- type ReceiverPlugin
- type Recv
- type ReliableSend
- type Run
- type Runner
- type Send
- type SendRequest
- type SerialReceiver
- type StaticGeneratorMessages
- type StreamDecoder
- type StreamEncoder
- func (s *StreamEncoder) Close() error
- func (s *StreamEncoder) EncodedBytes() uint64
- func (s *StreamEncoder) Flush() error
- func (s *StreamEncoder) Init(comp StreamHeader_Compression) error
- func (s *StreamEncoder) OpenFile(f *os.File) error
- func (s *StreamEncoder) Receive(m *Message) error
- func (s *StreamEncoder) WriteCustomHeader(hdr *StreamHeader) error
- type StreamHeader
- func (this *StreamHeader) Equal(that interface{}) bool
- func (m *StreamHeader) GetCompression() StreamHeader_Compression
- func (m *StreamHeader) GetMode() StreamHeader_Mode
- func (m *StreamHeader) Marshal() (data []byte, err error)
- func (m *StreamHeader) MarshalTo(data []byte) (n int, err error)
- func (*StreamHeader) ProtoMessage()
- func (m *StreamHeader) Reset()
- func (m *StreamHeader) Size() (n int)
- func (m *StreamHeader) String() string
- func (m *StreamHeader) Unmarshal(data []byte) error
- func (h *StreamHeader) UnmarshalFrom(r io.Reader) error
- func (this *StreamHeader) VerboseEqual(that interface{}) error
- type StreamHeader_Compression
- type StreamHeader_Mode
- type Stringer
- type Tag
- func (this *Tag) Equal(that interface{}) bool
- func (m *Tag) GetName() string
- func (m *Tag) GetValue() string
- func (m *Tag) Marshal() (data []byte, err error)
- func (m *Tag) MarshalTo(data []byte) (n int, err error)
- func (*Tag) ProtoMessage()
- func (m *Tag) Reset()
- func (m *Tag) Size() (n int)
- func (m *Tag) String() string
- func (m *Tag) Unmarshal(data []byte) error
- func (this *Tag) VerboseEqual(that interface{}) error
- type TestPlugin
- func (t *TestPlugin) Close() error
- func (t *TestPlugin) Description() string
- func (t *TestPlugin) Filter(m *Message) (*Message, error)
- func (t *TestPlugin) Filterer() (Filterer, error)
- func (t *TestPlugin) Generate() (*Message, error)
- func (t *TestPlugin) Generator() (Generator, error)
- func (t *TestPlugin) Init()
- func (t *TestPlugin) Receive(m *Message) error
- func (t *TestPlugin) Receiver() (Receiver, error)
Constants ¶
const AUDIT = 3
Type code for an audit (ie, high value log) message
const CypressPathEnv = "CYPRESS_PATH"
const DEFAULT_VERSION = 1
The default version of messages generated
const DefaultSocketPath = "/var/lib/cypress.sock"
The path on this system that the agent listens
const HEARTBEAT = 4
Type code for a heartbeat, representing liveness.
const LOG = 0
Type code representing a generic log message
const METRIC = 1
Type code for a metric
const TRACE = 2
Type code for an application trace
Variables ¶
var ( // The given message was invalid ErrInvalidMessage = errors.New("invalid message") // The system could not deduce the encoding of a stream ErrUnknownStreamType = errors.New("unknown stream type") )
var ( // Indicates that a Plugin does not have a Receiver ErrNoReceiver = errors.New("no receiver available") // Indicates that a Plugin does not have a Generator ErrNoGenerator = errors.New("no generator available") )
var ( // Disable windowing, acknowledge each message immediately NoWindow int = -1 // An average messages/sec rate to calculate against DefaultMPSRate int = 1000 // A decent minimum window that assures some improved throughput MinimumWindow = MinimumSendWindow(1*time.Millisecond, DefaultMPSRate) // A window for use on a fast lan where transmission delay is very small FastLanWindow = MinimumWindow // A window for use on a slower lan (cloud infrastructer, across AZ) SlowLanWindow = MinimumSendWindow(3*time.Millisecond, DefaultMPSRate) // A window for use over faster internet paths FastInternetWindow = MinimumSendWindow(10*time.Millisecond, DefaultMPSRate) // A window for use over slowe internet paths SlowInternetWindow = MinimumSendWindow(50*time.Millisecond, DefaultMPSRate) )
var EmptyGlobalConfig bool
Whether or not to load the global Config from paths
var ErrBadValue = errors.New("Invalid type for attribute value")
Error indicating that the value type and the attribute type mismatch
var ErrClosed = errors.New("send closed")
Indicate that this Send is closed and can not be used
var ErrOverflow = errors.New("overflow parsing varint")
Indicate that the varint is invalid
var ErrStreamUnsynced = errors.New("stream unsynced")
Indicates that both sides of the stream have gotten confused and are no longer is sync.
var GlobalConfigPaths []string
Paths that can hold the global config
var GlobalPaths []string
Paths that can contain any global cypress data
var HomeDir string
var NONE = StreamHeader_NONE
No compression is applied
var PotentialGlobalPaths = []string{
"/etc/cypress",
"/var/lib/cypress",
}
Paths that, if they exist, are added to GlobalConfigPaths
var SNAPPY = StreamHeader_SNAPPY
Snappy compression is used
var StreamHeader_Compression_name = map[int32]string{
0: "NONE",
1: "SNAPPY",
2: "ZLIB",
}
var StreamHeader_Compression_value = map[string]int32{
"NONE": 0,
"SNAPPY": 1,
"ZLIB": 2,
}
var StreamHeader_Mode_name = map[int32]string{
0: "RAW",
1: "RELIABLE",
}
var StreamHeader_Mode_value = map[string]int32{
"RAW": 0,
"RELIABLE": 1,
}
var StreamNotifyByte = []byte{'-'}
var UserConfigPath = UserPath + "/config"
The path under a users home for the user config
var UserPath = ".cypress"
var ZLIB = StreamHeader_ZLIB
ZLib compression is used
Functions ¶
func AllPlugins ¶
func AllPlugins() []string
func ExpandPath ¶
func GlobalFile ¶
Retrieve the path for under global cypress directories
func GlueFiltered ¶
Read messages from gen and send them to recv
func LoadMergedConfig ¶
func LogPath ¶
func LogPath() string
Return the default log path. The environment variable LOG_PATH is used if set, otherwise DefaultSocketPath.
func MinimumSendWindow ¶
Given the transmission delay of the network (t) and the expected messages per second (mps), calculate the minimum window to use to maximize throughput.
func ParseKVStream ¶
Given a reader, parse it as KV lines and send the message to r
func ReadCompressed ¶
func ReadCompressed(r io.Reader, comp StreamHeader_Compression) io.Reader
Given a compression level, return a wrapped Reader
func ReadUvarint ¶
Read a unsigned varint from the reader using buf as scratch. This reads data from r one byte at a time, making it a little slower if r is a net.Conn, but it keeps r positioned correctly as opposed to using a buffered reader.
func StandardStreamFilter ¶
func WriteCompressed ¶
func WriteCompressed(w io.WriteCloser, comp StreamHeader_Compression) io.WriteCloser
Given a compression level, return a wrapped Writer
Types ¶
type Attribute ¶
type Attribute struct { Key uint32 `protobuf:"varint,1,req,name=key" json:"key" codec:"key,omitempty"` Skey *string `protobuf:"bytes,2,opt,name=skey" json:"skey,omitempty" codec:"skey,omitempty"` Ival *int64 `protobuf:"zigzag64,3,opt,name=ival" json:"ival,omitempty" codec:"ival,omitempty"` Sval *string `protobuf:"bytes,4,opt,name=sval" json:"sval,omitempty" codec:"sval,omitempty"` Bval []byte `protobuf:"bytes,5,opt,name=bval" json:"bval,omitempty" codec:"bval,omitempty"` Tval *Interval `protobuf:"bytes,6,opt,name=tval" json:"tval,omitempty" codec:"tval,omitempty"` Boolval *bool `protobuf:"varint,7,opt,name=boolval" json:"boolval,omitempty" codec:"boolval,omitempty"` Fval *float64 `protobuf:"fixed64,8,opt,name=fval" json:"fval,omitempty" codec:"fval,omitempty"` XXX_unrecognized []byte `json:"-" codec:"-"` }
func (*Attribute) GetBoolval ¶
func (*Attribute) KVStringInto ¶
Write a Message's attributes in KV format to a buffer
func (*Attribute) ProtoMessage ¶
func (*Attribute) ProtoMessage()
func (*Attribute) VerboseEqual ¶
type BufferReceiver ¶
type BufferReceiver struct { Messages []*Message // contains filtered or unexported fields }
A simple type that stores any Received message into a buffer. Mostly for testing.
func (*BufferReceiver) Close ¶
func (b *BufferReceiver) Close() error
func (*BufferReceiver) Receive ¶
func (b *BufferReceiver) Receive(m *Message) error
Store the message into the internal buffer
func (*BufferReceiver) SyncTo ¶
func (b *BufferReceiver) SyncTo()
Used for testing to syncronize goroutines using the value
type ByteBuffer ¶
func (*ByteBuffer) Close ¶
func (bb *ByteBuffer) Close() error
type Channel ¶
type Channel chan *Message
A Go channel that fits the Receiver and Generator interfaces.
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
A type that, given a stream of many shapes, decodes it and generates Messages.
type Duration ¶
func (*Duration) UnmarshalTOML ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
A type which encodes messages given to it in native protobuf format and writes them out.
func NewEncoder ¶
Create an Encoder that will write it's output to w
type Filterer ¶
A core interface, representing a type that takes a message and returns a new message. The returned message can be nil.
type FiltererPlugin ¶
type GeneratorHandler ¶
type GeneratorHandler interface {
HandleGenerator(g Generator)
}
Use to allow types to handle new Generators as they're created
type GeneratorHandlerFunc ¶
type GeneratorHandlerFunc func(g Generator)
A GeneratorHandler that just calls itself as a function
func (GeneratorHandlerFunc) HandleGenerator ¶
func (f GeneratorHandlerFunc) HandleGenerator(g Generator)
type GeneratorPlugin ¶
type Interval ¶
type Interval struct { Seconds uint64 `protobuf:"varint,1,req,name=seconds" json:"seconds" codec:"seconds"` Nanoseconds uint32 `protobuf:"varint,2,req,name=nanoseconds" json:"nanoseconds" codec:"nanoseconds"` XXX_unrecognized []byte `json:"-" codec:"-"` }
func (*Interval) GetNanoseconds ¶
func (*Interval) GetSeconds ¶
func (*Interval) ProtoMessage ¶
func (*Interval) ProtoMessage()
func (*Interval) VerboseEqual ¶
type KVEncoder ¶
type KVEncoder struct {
// contains filtered or unexported fields
}
An encoder that writes messages in Key/Value format
func NewKVEncoder ¶
Create a KVEncoder that writes it's output to w
type KVParser ¶
type KVParser struct { Bare bool // contains filtered or unexported fields }
A type which can transform a io.Reader into a set of Messages
type Message ¶
type Message struct { Version int32 `protobuf:"varint,6,opt,name=version" json:"version" codec:"version"` Timestamp *tai64n.TAI64N `protobuf:"bytes,1,req,name=timestamp" json:"timestamp,omitempty" codec:"timestamp"` Type *uint32 `protobuf:"varint,2,req,name=type" json:"type,omitempty" codec:"type"` Attributes []*Attribute `protobuf:"bytes,3,rep,name=attributes" json:"attributes,omitempty" codec:"attributes"` SessionId *string `protobuf:"bytes,4,opt,name=session_id" json:"session_id,omitempty" codec:"session_id"` Tags []*Tag `protobuf:"bytes,5,rep" json:"Tags,omitempty" codec:"tags"` XXX_unrecognized []byte `json:"-" codec:"-"` }
func ParseSimpleJSON ¶
Generate a Message from json in data
func (*Message) Add ¶
Add a new attribute to the Message. The type of the attribute is infered from the type of val. This understands:
int, int32, uint32, int64, uint64, Inter float32, float64, string, Stringer time.Duration []byte error A slice, array, map, or struct containing any understood type
func (*Message) AddDuration ¶
Add an Attribute of type Internal from a time.Duration
func (*Message) AddInterval ¶
Add an Attribute of type Internal
func (*Message) AddMany ¶
Add many attributes to the Message. vals is pairs of (key, value) For example:
m.AddMany("name", "evan", "age", 35)
This creates an attributed with a key of "name" and a value of "evan" and "age" with a value of 35.
func (*Message) GetAttributes ¶
func (*Message) GetInterval ¶
Find an Attibute by name that is an Interval and return it
func (*Message) GetSessionId ¶
func (*Message) GetTimestamp ¶
func (*Message) GetVersion ¶
func (*Message) HstoreAttributes ¶
Return the Message's attributes as a string formatted for use in Postgresql HSTORE
func (*Message) HstoreAttributesInto ¶
Write a Message's attributes formatted for Postgresql HSTORE into a buffer
func (*Message) HstoreTags ¶
Return the Message's tags as a string formatted for use in Postgresql HSTORE
func (*Message) HstoreTagsInto ¶
Write a Message's tags formatted for Postgresql HSTORE into a buffer
func (*Message) HumanString ¶
Return a Message as a string formatted for easy human reading
func (*Message) KVPairsInto ¶
Write a Message's attributes in KV format to a buffer
func (*Message) KVStringInto ¶
Write a Message in KV format to a buffer
func (*Message) KVTagsInto ¶
Write a Message's tags in KV format to a buffer
func (*Message) MarshalJSON ¶
Generate JSON for a Message
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) SimpleJSONMap ¶
Return a simple map representing the Message used to generate JSON
func (*Message) StringType ¶
Return the Message type as a string
func (*Message) SyslogString ¶
Return a Message formatted as a syslog string. colorize indicates if ANSI color codes should be used to highlight portions. align controls if time field is aligned to 35 bytes (useful for when a set of messages are displayed on lines next to eachother).
func (*Message) UnmarshalJSON ¶
Populate a Message from JSON in data
func (*Message) VerboseEqual ¶
type MessageEncoder ¶
type Messages ¶
type Messages []*Message
A slices of Messages that can be used to order messages by Timestamp
type Plugin ¶
type Plugin interface{}
An interface implemented by plugins used by the router
func FindPlugin ¶
Find a plugin by name and invoke it's creator function to create a new Plugin instance
type Probe ¶
type Probe struct { Header *StreamHeader Stream io.Reader // contains filtered or unexported fields }
A type which can look at a reader and detect the format
func (*Probe) Compression ¶
func (p *Probe) Compression() StreamHeader_Compression
Indicate the compression in use
func (*Probe) Writer ¶
func (p *Probe) Writer(w io.WriteCloser) io.WriteCloser
Create an io.Writer that will match the parameters of the probed stream.
type ReceiverPlugin ¶
type Recv ¶
type Recv struct {
// contains filtered or unexported fields
}
A type which can recieve a stream of Messages reliabliy. Recv works in coordination with Send to reliablity send Messages using ack'ing.
type ReliableSend ¶
type ReliableSend struct {
// contains filtered or unexported fields
}
func NewReliableSend ¶
func NewReliableSend(c Connector, buffer int) *ReliableSend
func (*ReliableSend) Ack ¶
func (r *ReliableSend) Ack(m *Message)
func (*ReliableSend) Close ¶
func (r *ReliableSend) Close() error
func (*ReliableSend) Flush ¶
func (r *ReliableSend) Flush() error
func (*ReliableSend) Nack ¶
func (r *ReliableSend) Nack(m *Message)
func (*ReliableSend) Outstanding ¶
func (r *ReliableSend) Outstanding() int
func (*ReliableSend) Receive ¶
func (r *ReliableSend) Receive(m *Message) error
func (*ReliableSend) Start ¶
func (r *ReliableSend) Start() error
type Run ¶
type Run struct {
// contains filtered or unexported fields
}
A type which runs a command and generates messages from the commands standard output.
type Runner ¶
A core interface, represents a type that runs and sends messages to a downstream receiver
type Send ¶
type Send struct { OnClosed func() // contains filtered or unexported fields }
A type use to send a stream of Messages reliably. This type works in coordination with Recv to make transport the stream reliably by buffering and acking messages.
func NewSend ¶
func NewSend(rw io.ReadWriteCloser, window int) *Send
Create a new Send, reading and writing from rw. Window controls the size of the ack window to use. See MinimumSendWindow and the Window variables for information window sizes. If the window is set to 0, the default window size is used. NOTE: The window size has a big effect on the throughput of Send, so be sure to consider it's value. The larger the window, the higher the memory usage and throughput. Fast lans only require a small window because there is a very small transmission delay.
func (*Send) Send ¶
func (s *Send) Send(m *Message, req SendRequest) error
Send a Message to the remote side. if req is not nil, then it will be updated as to the status of m, calling either Ack or Nack depending on if things go ok or not.
func (*Send) SendHandshake ¶
Send the start of a stream to the remote side. This will initialize the stream to use Snappy for compression and reliable transmission.
type SendRequest ¶
Used by Send to allow a sender to interact with the Message transmit and ack lifecycle
type SerialReceiver ¶
type SerialReceiver struct { Receiver Receiver // contains filtered or unexported fields }
A type that wraps a Receiver in a mutex
func NewSerialReceiver ¶
func NewSerialReceiver(r Receiver) *SerialReceiver
func (*SerialReceiver) Receive ¶
func (s *SerialReceiver) Receive(m *Message) error
type StaticGeneratorMessages ¶
type StaticGeneratorMessages struct {
// contains filtered or unexported fields
}
A type which holds a set of Messages and returns them when requested Mostly used for testing.
func StaticGenerator ¶
func StaticGenerator(m ...*Message) *StaticGeneratorMessages
Create a StaticGeneratorMessages from the given Message set
func (*StaticGeneratorMessages) Close ¶
func (s *StaticGeneratorMessages) Close() error
To satisfy the Generator interface
func (*StaticGeneratorMessages) Generate ¶
func (s *StaticGeneratorMessages) Generate() (*Message, error)
Return the next Message or nil if empty
type StreamDecoder ¶
type StreamDecoder struct { Header *StreamHeader // contains filtered or unexported fields }
A type which uses Probe and Decoder generate Messages
func NewStreamDecoder ¶
func NewStreamDecoder(r io.Reader) (*StreamDecoder, error)
Create a new StreamDecoder from the data in r
func (*StreamDecoder) Close ¶
func (s *StreamDecoder) Close() error
To satisify the Generator interface
func (*StreamDecoder) Generate ¶
func (s *StreamDecoder) Generate() (*Message, error)
Read the next Message in the stream. If the stream has not been initialized, Probe() is called first.
func (*StreamDecoder) Probe ¶
func (s *StreamDecoder) Probe() error
Probe the stream and setup the decoder to read Messages
type StreamEncoder ¶
type StreamEncoder struct {
// contains filtered or unexported fields
}
A type that encodes Messages to a stream with optional compression
func NewStreamEncoder ¶
func NewStreamEncoder(w io.WriteCloser) *StreamEncoder
Create a new StreamEncoder sending data to w. The format is either the native format or kv format if w is stdout and a tty.
func (*StreamEncoder) Close ¶
func (s *StreamEncoder) Close() error
func (*StreamEncoder) EncodedBytes ¶
func (s *StreamEncoder) EncodedBytes() uint64
Indicate how many bytes have been sent
func (*StreamEncoder) Flush ¶
func (s *StreamEncoder) Flush() error
func (*StreamEncoder) Init ¶
func (s *StreamEncoder) Init(comp StreamHeader_Compression) error
Initialize the StreamEncoder to a particular compression level and write the header
func (*StreamEncoder) OpenFile ¶
func (s *StreamEncoder) OpenFile(f *os.File) error
Probe the file and setup the encoder to match the probe's settings.
func (*StreamEncoder) Receive ¶
func (s *StreamEncoder) Receive(m *Message) error
Take a Message and encode it
func (*StreamEncoder) WriteCustomHeader ¶
func (s *StreamEncoder) WriteCustomHeader(hdr *StreamHeader) error
Write a StreamHeader
type StreamHeader ¶
type StreamHeader struct { Compression *StreamHeader_Compression `protobuf:"varint,1,opt,name=compression,enum=cypress.StreamHeader_Compression" json:"compression,omitempty"` Mode *StreamHeader_Mode `protobuf:"varint,2,opt,name=mode,enum=cypress.StreamHeader_Mode" json:"mode,omitempty"` XXX_unrecognized []byte `json:"-" codec:"-"` }
func (*StreamHeader) Equal ¶
func (this *StreamHeader) Equal(that interface{}) bool
func (*StreamHeader) GetCompression ¶
func (m *StreamHeader) GetCompression() StreamHeader_Compression
func (*StreamHeader) GetMode ¶
func (m *StreamHeader) GetMode() StreamHeader_Mode
func (*StreamHeader) Marshal ¶
func (m *StreamHeader) Marshal() (data []byte, err error)
func (*StreamHeader) ProtoMessage ¶
func (*StreamHeader) ProtoMessage()
func (*StreamHeader) Reset ¶
func (m *StreamHeader) Reset()
func (*StreamHeader) Size ¶
func (m *StreamHeader) Size() (n int)
func (*StreamHeader) String ¶
func (m *StreamHeader) String() string
func (*StreamHeader) Unmarshal ¶
func (m *StreamHeader) Unmarshal(data []byte) error
func (*StreamHeader) UnmarshalFrom ¶
func (h *StreamHeader) UnmarshalFrom(r io.Reader) error
func (*StreamHeader) VerboseEqual ¶
func (this *StreamHeader) VerboseEqual(that interface{}) error
type StreamHeader_Compression ¶
type StreamHeader_Compression int32
const ( StreamHeader_NONE StreamHeader_Compression = 0 StreamHeader_SNAPPY StreamHeader_Compression = 1 StreamHeader_ZLIB StreamHeader_Compression = 2 )
func (StreamHeader_Compression) Enum ¶
func (x StreamHeader_Compression) Enum() *StreamHeader_Compression
func (StreamHeader_Compression) String ¶
func (x StreamHeader_Compression) String() string
func (*StreamHeader_Compression) UnmarshalJSON ¶
func (x *StreamHeader_Compression) UnmarshalJSON(data []byte) error
type StreamHeader_Mode ¶
type StreamHeader_Mode int32
const ( StreamHeader_RAW StreamHeader_Mode = 0 StreamHeader_RELIABLE StreamHeader_Mode = 1 )
func (StreamHeader_Mode) Enum ¶
func (x StreamHeader_Mode) Enum() *StreamHeader_Mode
func (StreamHeader_Mode) String ¶
func (x StreamHeader_Mode) String() string
func (*StreamHeader_Mode) UnmarshalJSON ¶
func (x *StreamHeader_Mode) UnmarshalJSON(data []byte) error
type Tag ¶
type Tag struct { Name string `protobuf:"bytes,1,req,name=name" json:"name" codec:"name"` Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty" codec:"value,omitempty"` XXX_unrecognized []byte `json:"-" codec:"-"` }
func (*Tag) ProtoMessage ¶
func (*Tag) ProtoMessage()
func (*Tag) VerboseEqual ¶
type TestPlugin ¶
Used for testing only
func (*TestPlugin) Close ¶
func (t *TestPlugin) Close() error
func (*TestPlugin) Description ¶
func (t *TestPlugin) Description() string
func (*TestPlugin) Filterer ¶
func (t *TestPlugin) Filterer() (Filterer, error)
func (*TestPlugin) Generate ¶
func (t *TestPlugin) Generate() (*Message, error)
func (*TestPlugin) Generator ¶
func (t *TestPlugin) Generator() (Generator, error)
func (*TestPlugin) Init ¶
func (t *TestPlugin) Init()
func (*TestPlugin) Receive ¶
func (t *TestPlugin) Receive(m *Message) error
func (*TestPlugin) Receiver ¶
func (t *TestPlugin) Receiver() (Receiver, error)
Source Files ¶
- buffer.go
- byte_buffer.go
- channel.go
- compress.go
- config.go
- decoder.go
- encoder.go
- errors.go
- generator.go
- global.go
- global_config.go
- glue.go
- header.go
- interfaces.go
- json.go
- kv.go
- log.go
- log.pb.go
- memory.go
- messages.go
- path.go
- peek.go
- plugins.go
- probe.go
- recv.go
- reliable_send.go
- run.go
- send.go
- serial.go
- stream_decoder.go
- stream_encoder.go
- symbols.go
- system.go
- varint.go
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
plugins
|
|
Package scanner provides a scanner and tokenizer for UTF-8-encoded text.
|
Package scanner provides a scanner and tokenizer for UTF-8-encoded text. |