Documentation

Overview

    Package streamproto describes the protocol primitives used by LogDog/Butler for stream negotiation.

    A LogDog Butler client wishing to create a new LogDog stream can use the Flags type to configure/send the stream.

    Internally, LogDog represents the Flags properties with the Properties type.

    Index

    Constants

    This section is empty.

    Variables

    View Source
    var (
    	// ProtocolFrameHeaderMagic is the number at the beginning of streams that
    	// identifies the stream handshake version.
    	//
    	// This serves two purposes:
    	//   - To disambiguate a Butler stream from some happenstance string of bytes
    	//     (which probably won't start with these characters).
    	//   - To allow an upgrade to the wire format, if one is ever needed. e.g.,
    	//     a switch to something other than recordio/JSON.
    	ProtocolFrameHeaderMagic = []byte("BTLR1\x1E")
    )
    View Source
    var (
    	// StreamTypeFlagEnum maps configuration strings to their underlying StreamTypes.
    	StreamTypeFlagEnum = flagenum.Enum{
    		"text":     StreamType(logpb.StreamType_TEXT),
    		"binary":   StreamType(logpb.StreamType_BINARY),
    		"datagram": StreamType(logpb.StreamType_DATAGRAM),
    	}
    )

    Functions

    func LocalNamedPipePath

    func LocalNamedPipePath(base string) string

      LocalNamedPipePath returns the path to a local Windows named pipe named `base`. This is used with the 'net.pipe' butler protocol.

      Types

      type Flags

      type Flags struct {
      	Name        StreamNameFlag `json:"name,omitempty"`
      	ContentType string         `json:"contentType,omitempty"`
      	Type        StreamType     `json:"type,omitempty"`
      	Timestamp   clockflag.Time `json:"timestamp,omitempty"`
      	Tags        TagMap         `json:"tags,omitempty"`
      }

        Flags is a flag- and JSON-compatible version of logpb.LogStreamDescriptor. It is used for stream negotiation protocol and command-line interfaces.

        TODO(iannucci) - Change client->butler protocol to just use jsonpb encoding of LogStreamDescriptor.

        func (*Flags) Descriptor

        func (f *Flags) Descriptor() *logpb.LogStreamDescriptor

          Descriptor converts the Flags to a LogStreamDescriptor.

          func (*Flags) FromHandshake

          func (f *Flags) FromHandshake(r io.Reader) error

            FromHandshake reads the butler protocol header handshake from the given Reader.

            func (*Flags) WriteHandshake

            func (f *Flags) WriteHandshake(w io.Writer) error

              WriteHandshake writes the butler protocol header handshake on the given Writer.

              type StreamNameFlag

              type StreamNameFlag types.StreamName

                StreamNameFlag is a flag and JSON-compatible type that converts to/from a types.StreamName. StreamName validation is part of the conversion.

                func (StreamNameFlag) MarshalJSON

                func (f StreamNameFlag) MarshalJSON() ([]byte, error)

                  MarshalJSON implements json.Marshaler.

                  func (*StreamNameFlag) Set

                  func (f *StreamNameFlag) Set(v string) error

                    Set implements flag.Value.

                    func (*StreamNameFlag) String

                    func (f *StreamNameFlag) String() string

                      String implements flag.Value.

                      func (*StreamNameFlag) UnmarshalJSON

                      func (f *StreamNameFlag) UnmarshalJSON(data []byte) error

                        UnmarshalJSON implements json.Unmarshaler.

                        type StreamType

                        type StreamType logpb.StreamType

                          StreamType is a flag- and JSON-compatible wrapper around the StreamType protobuf field.

                          func (StreamType) DefaultContentType

                          func (t StreamType) DefaultContentType() types.ContentType

                            DefaultContentType returns the default ContentType for a given stream type.

                            func (StreamType) MarshalJSON

                            func (t StreamType) MarshalJSON() ([]byte, error)

                              MarshalJSON implements json.Marshaler.

                              func (*StreamType) Set

                              func (t *StreamType) Set(v string) error

                                Set implements flag.Value.

                                func (*StreamType) String

                                func (t *StreamType) String() string

                                  String implements flag.Value.

                                  func (*StreamType) UnmarshalJSON

                                  func (t *StreamType) UnmarshalJSON(data []byte) error

                                    UnmarshalJSON implements json.Unmarshaler.

                                    type TagMap

                                    type TagMap stringmapflag.Value

                                      TagMap is a flags-compatible map used to store stream tags.

                                      func (*TagMap) MarshalJSON

                                      func (t *TagMap) MarshalJSON() ([]byte, error)

                                        MarshalJSON implements the json.Marshaler interface.

                                        func (*TagMap) Set

                                        func (t *TagMap) Set(key string) error

                                          Set implements flag.Value

                                          func (TagMap) SortedKeys

                                          func (t TagMap) SortedKeys() []string

                                            SortedKeys returns a sorted slice of the keys in a TagMap.

                                            func (*TagMap) String

                                            func (t *TagMap) String() string

                                              String implements flag.Value.

                                              func (*TagMap) UnmarshalJSON

                                              func (t *TagMap) UnmarshalJSON(data []byte) error

                                                UnmarshalJSON implements the json.Unmarshaler interface.