Documentation ¶
Overview ¶
Package streamfile defines a file format to record and replay packet stream files.
Stream files use Google's protobuf library. Each stream data block is composed of a series of protobuf messages, managed by the protostream package.
A stream "file" consists of three types of components:
- A base directory, which is considered the file's path and whiel contains all of the streamfile's data.
- A metadata protobuf file, stored in text protobuf format, which describes the layout of the file and its stream data.
- One or more event files, which contain raw binary stream data.
A stream file is constructed through atomic filesystem operations. During recording, it is built in a temporary directory. When complete, it is finished and then moved into its destination.
Stream files can be trivially merged together to form a composite stream file. This is done by hard-linking (or, failing that, copying) the event files from the merged streamfile into a new directory and then merging the metadata file.
streamfile supports compression. This is fairly necessary, as raw stream data can be huge:
- SNAPPY compression uses Google's Snappy compression algorithm for CPU- friendly reads and writes with a decent compression ratio.
- GZIP uses the gzip library. This is more CPU intensive but also more efficient than SNAPPY.
- RAW avoids compression altogether. This may be useful when the underlying filesystem offers compression, as "btrfs" does.
## Regenerating Protobufs
When changes to the ".proto" files are made, the generated protobuf Go code must be regenerated. This is done through a Makefile, but is wired into "go:generate" for convenience.
Since it requires non-Go components, protobuf regeneration is gated on the "protoc" build tag. It can be run by calling:
go generate -tags 'protoc' ./replay/streamfile/...
Package streamfile is a generated protocol buffer package.
It is generated from these files:
streamfile.proto event.proto
It has these top-level messages:
Metadata Device Event PixelPusherPixels
Index ¶
- Variables
- func CompressionFlagValues() string
- func Delete(path string) error
- func LoadMetadata(path string, md *Metadata) error
- func Validate(path string) error
- type Compression
- type CompressionFlag
- type Device
- func (*Device) Descriptor() ([]byte, []int)
- func (s *Device) DeviceOrdinal() device.Ordinal
- func (m *Device) GetId() string
- func (m *Device) GetOrdinal() *Device_Ordinal
- func (m *Device) GetPixelsPerStrip() int64
- func (m *Device) GetStrip() []*Device_Strip
- func (*Device) ProtoMessage()
- func (m *Device) Reset()
- func (m *Device) String() string
- func (s *Device) StripFlags() []pixelpusher.StripFlags
- type Device_Ordinal
- type Device_Strip
- type Device_Strip_PixelType
- type Event
- func (*Event) Descriptor() ([]byte, []int)
- func (m *Event) GetData() isEvent_Data
- func (m *Event) GetOffset() *google_protobuf.Duration
- func (m *Event) GetPacket() *Event_Packet
- func (*Event) ProtoMessage()
- func (m *Event) Reset()
- func (m *Event) String() string
- func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type EventStreamConfig
- type EventStreamReader
- func (esr *EventStreamReader) Close() error
- func (esr *EventStreamReader) Duration() time.Duration
- func (esr *EventStreamReader) GetDevice(index int64) *Device
- func (esr *EventStreamReader) Metadata() *Metadata
- func (esr *EventStreamReader) Path() string
- func (esr *EventStreamReader) Position() time.Duration
- func (esr *EventStreamReader) ReadEvent() (*Event, error)
- func (esr *EventStreamReader) Reset() error
- func (esr *EventStreamReader) ResolveDeviceForIndex(index int64) *Device
- type EventStreamWriter
- func (esw *EventStreamWriter) Close() error
- func (esw *EventStreamWriter) Duration() time.Duration
- func (esw *EventStreamWriter) NumBytes() int64
- func (esw *EventStreamWriter) NumEvents() int64
- func (esw *EventStreamWriter) Path() string
- func (esw *EventStreamWriter) WritePacket(d device.D, pkt *protocol.Packet) error
- type Event_Packet
- func (ec *Event_Packet) Decode(d *Device) (*protocol.Packet, error)
- func (*Event_Packet) Descriptor() ([]byte, []int)
- func (m *Event_Packet) GetContents() isEvent_Packet_Contents
- func (m *Event_Packet) GetDevice() int64
- func (m *Event_Packet) GetPixelpusherPixels() *PixelPusherPixels
- func (*Event_Packet) ProtoMessage()
- func (m *Event_Packet) Reset()
- func (m *Event_Packet) String() string
- func (*Event_Packet) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type Event_Packet_
- type Event_Packet_PixelpusherPixels
- type Metadata
- func (*Metadata) Descriptor() ([]byte, []int)
- func (m *Metadata) GetCompression() Compression
- func (m *Metadata) GetCreated() *google_protobuf1.Timestamp
- func (m *Metadata) GetDevices() []*Device
- func (m *Metadata) GetDuration() *google_protobuf.Duration
- func (m *Metadata) GetEventFile() []string
- func (m *Metadata) GetEventFileInfo() []*Metadata_EventFile
- func (m *Metadata) GetMinor() uint32
- func (m *Metadata) GetName() string
- func (m *Metadata) GetNumBytes() int64
- func (m *Metadata) GetNumEvents() int64
- func (m *Metadata) GetVersion() Metadata_Version
- func (*Metadata) ProtoMessage()
- func (m *Metadata) Reset()
- func (m *Metadata) String() string
- type MetadataBuilder
- func (mb *MetadataBuilder) AddEventFile(name string, comp Compression)
- func (mb *MetadataBuilder) GetDeviceInternalIndex(id string, gen func() *Device) int64
- func (mb *MetadataBuilder) Merge(md *Metadata) error
- func (mb *MetadataBuilder) NumBytes() int64
- func (mb *MetadataBuilder) NumEvents() int64
- func (mb *MetadataBuilder) Offset() time.Duration
- func (mb *MetadataBuilder) RecordEvent(bytes int64, offset time.Duration)
- func (mb *MetadataBuilder) Write(path string) error
- type Metadata_EventFile
- func (*Metadata_EventFile) Descriptor() ([]byte, []int)
- func (efi *Metadata_EventFile) DeviceForInternalIndex(index int64, md *Metadata) *Device
- func (m *Metadata_EventFile) GetCompression() Compression
- func (m *Metadata_EventFile) GetDeviceMapping() []int64
- func (m *Metadata_EventFile) GetDuration() *google_protobuf.Duration
- func (m *Metadata_EventFile) GetName() string
- func (m *Metadata_EventFile) GetNumBytes() int64
- func (m *Metadata_EventFile) GetNumEvents() int64
- func (*Metadata_EventFile) ProtoMessage()
- func (m *Metadata_EventFile) Reset()
- func (m *Metadata_EventFile) String() string
- type Metadata_Version
- type PixelPusherPixels
Constants ¶
This section is empty.
Variables ¶
var Compression_name = map[int32]string{
0: "SNAPPY",
1: "NONE",
2: "GZIP",
}
var Compression_value = map[string]int32{
"SNAPPY": 0,
"NONE": 1,
"GZIP": 2,
}
var Device_Strip_PixelType_name = map[int32]string{
0: "RGB",
1: "RGBOW",
}
var Device_Strip_PixelType_value = map[string]int32{
"RGB": 0,
"RGBOW": 1,
}
var ErrEncodingNotSupported = errors.New("packet encoding not supported")
ErrEncodingNotSupported is an error returned when a requested encoding is not supported.
var Metadata_Version_name = map[int32]string{
0: "UNKNOWN",
1: "V_1",
}
var Metadata_Version_value = map[string]int32{
"UNKNOWN": 0,
"V_1": 1,
}
Functions ¶
func CompressionFlagValues ¶
func CompressionFlagValues() string
CompressionFlagValues returns the list of possible values for a CompressionFlag.
func LoadMetadata ¶
LoadMetadata loads information block from the named file.
If the loaded Metadata file is not completely up-to-date, LoadMetadata will attempt to patch it.
Types ¶
type Compression ¶
type Compression int32
Compression is a supported compression mode.
const ( Compression_SNAPPY Compression = 0 Compression_NONE Compression = 1 Compression_GZIP Compression = 2 )
func (Compression) EnumDescriptor ¶
func (Compression) EnumDescriptor() ([]byte, []int)
func (Compression) String ¶
func (x Compression) String() string
type CompressionFlag ¶
type CompressionFlag Compression
CompressionFlag is a pflag.Value implementation that stores a compression value.
func (*CompressionFlag) Set ¶
func (cf *CompressionFlag) Set(v string) error
Set implements pflag.Value.
func (*CompressionFlag) String ¶
func (cf *CompressionFlag) String() string
func (*CompressionFlag) Type ¶
func (cf *CompressionFlag) Type() string
Type implements pflag.Value.
func (CompressionFlag) Value ¶
func (cf CompressionFlag) Value() Compression
Value returns the compression value held by this flag.
type Device ¶
type Device struct { Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` // The number of pixels per strip. PixelsPerStrip int64 `protobuf:"varint,2,opt,name=pixels_per_strip,json=pixelsPerStrip" json:"pixels_per_strip,omitempty"` Strip []*Device_Strip `protobuf:"bytes,3,rep,name=strip" json:"strip,omitempty"` // Ordinal is the ordinal for this device. Is ordinal is empty, the device // does not have one (invalid). Ordinal *Device_Ordinal `protobuf:"bytes,4,opt,name=ordinal" json:"ordinal,omitempty"` }
Device is information about a device referenced in the event stream.
func (*Device) Descriptor ¶
func (*Device) DeviceOrdinal ¶
DeviceOrdinal returns a device ordinal for this device.
Is the device has an invalid ordinal, Ordinal will return an invalid ordinal.
func (*Device) GetOrdinal ¶
func (m *Device) GetOrdinal() *Device_Ordinal
func (*Device) GetPixelsPerStrip ¶
func (*Device) GetStrip ¶
func (m *Device) GetStrip() []*Device_Strip
func (*Device) ProtoMessage ¶
func (*Device) ProtoMessage()
func (*Device) StripFlags ¶
func (s *Device) StripFlags() []pixelpusher.StripFlags
StripFlags returns a flags representation for each strip in this Device.
type Device_Ordinal ¶
type Device_Ordinal struct { // The device's group number. Group int32 `protobuf:"varint,1,opt,name=group" json:"group,omitempty"` // The device's controller number. Controller int32 `protobuf:"varint,2,opt,name=controller" json:"controller,omitempty"` }
func (*Device_Ordinal) Descriptor ¶
func (*Device_Ordinal) Descriptor() ([]byte, []int)
func (*Device_Ordinal) GetController ¶
func (m *Device_Ordinal) GetController() int32
func (*Device_Ordinal) GetGroup ¶
func (m *Device_Ordinal) GetGroup() int32
func (*Device_Ordinal) ProtoMessage ¶
func (*Device_Ordinal) ProtoMessage()
func (*Device_Ordinal) Reset ¶
func (m *Device_Ordinal) Reset()
func (*Device_Ordinal) String ¶
func (m *Device_Ordinal) String() string
type Device_Strip ¶
type Device_Strip struct { // IsRgbow is true if this strip uses RGBOW PixelType Device_Strip_PixelType `protobuf:"varint,1,opt,name=pixel_type,json=pixelType,enum=streamfile.Device_Strip_PixelType" json:"pixel_type,omitempty"` }
Strip represents an LED strip in this Device.
func (*Device_Strip) Descriptor ¶
func (*Device_Strip) Descriptor() ([]byte, []int)
func (*Device_Strip) GetPixelType ¶
func (m *Device_Strip) GetPixelType() Device_Strip_PixelType
func (*Device_Strip) ProtoMessage ¶
func (*Device_Strip) ProtoMessage()
func (*Device_Strip) Reset ¶
func (m *Device_Strip) Reset()
func (*Device_Strip) String ¶
func (m *Device_Strip) String() string
func (*Device_Strip) StripFlags ¶
func (s *Device_Strip) StripFlags() pixelpusher.StripFlags
StripFlags returns the StripFlags equivalent data for this Strip.
type Device_Strip_PixelType ¶
type Device_Strip_PixelType int32
PixelType is the type of pixel that this strip uses.
const ( Device_Strip_RGB Device_Strip_PixelType = 0 Device_Strip_RGBOW Device_Strip_PixelType = 1 )
func (Device_Strip_PixelType) EnumDescriptor ¶
func (Device_Strip_PixelType) EnumDescriptor() ([]byte, []int)
func (Device_Strip_PixelType) String ¶
func (x Device_Strip_PixelType) String() string
type Event ¶
type Event struct { // The offset, from 0, of this packet. Offset *google_protobuf.Duration `protobuf:"bytes,1,opt,name=offset" json:"offset,omitempty"` // Event is the content of the event. // // Types that are valid to be assigned to Data: // *Event_Packet_ Data isEvent_Data `protobuf_oneof:"data"` }
Packet is an individual packet.
func (*Event) Descriptor ¶
func (*Event) GetOffset ¶
func (m *Event) GetOffset() *google_protobuf.Duration
func (*Event) GetPacket ¶
func (m *Event) GetPacket() *Event_Packet
func (*Event) ProtoMessage ¶
func (*Event) ProtoMessage()
type EventStreamConfig ¶
type EventStreamConfig struct { // WriterCompression is the compression to use when writing a file. WriterCompression Compression // WriterCompressionLevel is the compression level to apply to // WriterCompression, if applicable. WriterCompressionLevel int // TempDir is the temporary directory to use. TempDir string // NowFunc, if not nil, is the function to use to get the current time. If // nil, time.Now will be used. NowFunc func() time.Time }
EventStreamConfig is a configuration for the generation of event streams.
func (*EventStreamConfig) MakeEventStreamWriter ¶
func (cfg *EventStreamConfig) MakeEventStreamWriter(path, displayName string) (*EventStreamWriter, error)
MakeEventStreamWriter creates a EventStreamWriter instance.
func (*EventStreamConfig) Merge ¶
func (cfg *EventStreamConfig) Merge(dest, displayName string, paths ...string) error
Merge merges the stream files at the specified paths together to form a stream file at dest.
Ideally, the merge will be relatively instant, using hardlinks to clone the source data.
func (*EventStreamConfig) NewMetadataBuilder ¶
func (cfg *EventStreamConfig) NewMetadataBuilder(name string) (*MetadataBuilder, error)
NewMetadataBuilder constructs a new metadata builder instance.
type EventStreamReader ¶
type EventStreamReader struct {
// contains filtered or unexported fields
}
EventStreamReader reads events from a stream.
EventStreamReader must be instantiated using MakeEventStreamReader. After instantiation, EventStreamReader can be modified to control its behavior.
func MakeEventStreamReader ¶
func MakeEventStreamReader(path string) (*EventStreamReader, error)
MakeEventStreamReader instantiates a new EventStreamReader.
func (*EventStreamReader) Close ¶
func (esr *EventStreamReader) Close() error
Close closes the reader, freeing its underlying file.
func (*EventStreamReader) Duration ¶
func (esr *EventStreamReader) Duration() time.Duration
Duration returns the duration, loaded from the metadata duration field.
If the duration field is missing or invalid, a duration of 0 will be returned.
func (*EventStreamReader) GetDevice ¶
func (esr *EventStreamReader) GetDevice(index int64) *Device
GetDevice is a utility method to retrieve a device by index or return nil if the index is out of bounds.
index is taken in context of the current file being read.
func (*EventStreamReader) Metadata ¶
func (esr *EventStreamReader) Metadata() *Metadata
Metadata returns the metadata block for this file.
func (*EventStreamReader) Path ¶
func (esr *EventStreamReader) Path() string
Path returns the path of the stream file.
Path will return the path to the base directory.
func (*EventStreamReader) Position ¶
func (esr *EventStreamReader) Position() time.Duration
Position returns the offset of the latest read event.
func (*EventStreamReader) ReadEvent ¶
func (esr *EventStreamReader) ReadEvent() (*Event, error)
ReadEvent returns the next event in the stream.
Once ReadEvent returns successfully, the state of the stream can be further interrogated until the next ReadEvent call is made.
If the end of the stream is encountered, ReadEvent will return io.EOF.
func (*EventStreamReader) Reset ¶
func (esr *EventStreamReader) Reset() error
Reset clears state and causes the reader to reload the file.
Reset keeps the underlying file open.
func (*EventStreamReader) ResolveDeviceForIndex ¶
func (esr *EventStreamReader) ResolveDeviceForIndex(index int64) *Device
ResolveDeviceForIndex resolves the Device event stream record for the specified stream-internal device index.
ResolveDeviceForIndex is only valid until the next ReadEvent is called.
type EventStreamWriter ¶
type EventStreamWriter struct { *EventStreamConfig // contains filtered or unexported fields }
EventStreamWriter reads packets from a stream.
func (*EventStreamWriter) Close ¶
func (esw *EventStreamWriter) Close() error
Close closes the StreamWriter, finalizing the stream and releasing its resources.
func (*EventStreamWriter) Duration ¶
func (esw *EventStreamWriter) Duration() time.Duration
Duration is the total duration fo the recording so far.
func (*EventStreamWriter) NumBytes ¶
func (esw *EventStreamWriter) NumBytes() int64
NumBytes is the number of bytes that have been recorded so far.
func (*EventStreamWriter) NumEvents ¶
func (esw *EventStreamWriter) NumEvents() int64
NumEvents is the number of events that have been recorded so far.
func (*EventStreamWriter) Path ¶
func (esw *EventStreamWriter) Path() string
Path returns the path of the stream file being written.
Path will return the path to the destination directory, not the intermediate directory used to construct it.
func (*EventStreamWriter) WritePacket ¶
WritePacket writes a protocol packet event to the stream.
type Event_Packet ¶
type Event_Packet struct { // The index of the device to use. // // Mapping devices to indexes occurs externally. Device int64 `protobuf:"varint,1,opt,name=device" json:"device,omitempty"` // The packet contents. // // Types that are valid to be assigned to Contents: // *Event_Packet_PixelpusherPixels Contents isEvent_Packet_Contents `protobuf_oneof:"contents"` }
A single encoded packet, sent to a device.
func EncodePacket ¶
func EncodePacket(device int64, pkt *protocol.Packet) ([]*Event_Packet, error)
EncodePacket encodes a protocol packet as zero or more event packet messages.
If the packet could not be encoded, ErrEncodingNotSupported will be returned.
func (*Event_Packet) Decode ¶
func (ec *Event_Packet) Decode(d *Device) (*protocol.Packet, error)
Decode decodes this Packet into its protocol component.
Decode may reference byte streams in d, and the resulting Packet will only remain valid so long as the original d's bytes are valid. If this is a concern, d should be cloned prior to calling Decode to duplicate the buffer.
func (*Event_Packet) Descriptor ¶
func (*Event_Packet) Descriptor() ([]byte, []int)
func (*Event_Packet) GetContents ¶
func (m *Event_Packet) GetContents() isEvent_Packet_Contents
func (*Event_Packet) GetDevice ¶
func (m *Event_Packet) GetDevice() int64
func (*Event_Packet) GetPixelpusherPixels ¶
func (m *Event_Packet) GetPixelpusherPixels() *PixelPusherPixels
func (*Event_Packet) ProtoMessage ¶
func (*Event_Packet) ProtoMessage()
func (*Event_Packet) Reset ¶
func (m *Event_Packet) Reset()
func (*Event_Packet) String ¶
func (m *Event_Packet) String() string
func (*Event_Packet) XXX_OneofFuncs ¶
func (*Event_Packet) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type Event_Packet_ ¶
type Event_Packet_ struct {
Packet *Event_Packet `protobuf:"bytes,2,opt,name=packet,oneof"`
}
type Event_Packet_PixelpusherPixels ¶
type Event_Packet_PixelpusherPixels struct {
PixelpusherPixels *PixelPusherPixels `protobuf:"bytes,3,opt,name=pixelpusher_pixels,json=pixelpusherPixels,oneof"`
}
type Metadata ¶
type Metadata struct { Version Metadata_Version `protobuf:"varint,1,opt,name=version,enum=streamfile.Metadata_Version" json:"version,omitempty"` // Minor is the minor version of this file. It is enumerated within Version, // and is used for migration purposes. Minor uint32 `protobuf:"varint,11,opt,name=minor" json:"minor,omitempty"` // Name is the name of this file. Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` // DEPRECATED, use "event_file_info" instead! // // The relative paths of event files that compose this stream. // // TODO: Remove this once all files referencing it have been remedied. EventFile []string `protobuf:"bytes,3,rep,name=event_file,json=eventFile" json:"event_file,omitempty"` EventFileInfo []*Metadata_EventFile `protobuf:"bytes,10,rep,name=event_file_info,json=eventFileInfo" json:"event_file_info,omitempty"` // Created is the time when this file was created. Created *google_protobuf1.Timestamp `protobuf:"bytes,4,opt,name=created" json:"created,omitempty"` // Duration is the total duration of the event stream. Duration *google_protobuf.Duration `protobuf:"bytes,5,opt,name=duration" json:"duration,omitempty"` // Total number of individual events in the stream. NumEvents int64 `protobuf:"varint,6,opt,name=num_events,json=numEvents" json:"num_events,omitempty"` // Duration is the total duration of the event stream. NumBytes int64 `protobuf:"varint,7,opt,name=num_bytes,json=numBytes" json:"num_bytes,omitempty"` // DEPRECATED, in favor of per-file devices. // // If populated, the first EventFile will use this device list; otherwise // each individual EventFile will have its own devices list. // // TODO: Remove this once all files referencing it have been remedied. Devices []*Device `protobuf:"bytes,8,rep,name=devices" json:"devices,omitempty"` // DEPRECATED, in favor of per-file compression setting. // // If populated, the first EventFile will use this device list; otherwise // each individual EventFile will have its own devices list. // // TODO: Remove this once all files referencing it have been remedied. Compression Compression `protobuf:"varint,9,opt,name=compression,enum=streamfile.Compression" json:"compression,omitempty"` }
Metadata is file-level metadata.
func LoadMetadataAndSize ¶
LoadMetadataAndSize loads the metadata and total data file size for the specific path.
func (*Metadata) Descriptor ¶
func (*Metadata) GetCompression ¶
func (m *Metadata) GetCompression() Compression
func (*Metadata) GetCreated ¶
func (m *Metadata) GetCreated() *google_protobuf1.Timestamp
func (*Metadata) GetDevices ¶
func (*Metadata) GetDuration ¶
func (m *Metadata) GetDuration() *google_protobuf.Duration
func (*Metadata) GetEventFile ¶
func (*Metadata) GetEventFileInfo ¶
func (m *Metadata) GetEventFileInfo() []*Metadata_EventFile
func (*Metadata) GetNumBytes ¶
func (*Metadata) GetNumEvents ¶
func (*Metadata) GetVersion ¶
func (m *Metadata) GetVersion() Metadata_Version
func (*Metadata) ProtoMessage ¶
func (*Metadata) ProtoMessage()
type MetadataBuilder ¶
type MetadataBuilder struct {
// contains filtered or unexported fields
}
MetadataBuilder constructs a Metadata protobuf.
func (*MetadataBuilder) AddEventFile ¶
func (mb *MetadataBuilder) AddEventFile(name string, comp Compression)
AddEventFile adds a new event file with the provided parameters to the metadata block.
If an event file is currently open, it will be finished and appended to the metadata.
func (*MetadataBuilder) GetDeviceInternalIndex ¶
func (mb *MetadataBuilder) GetDeviceInternalIndex(id string, gen func() *Device) int64
GetDeviceInternalIndex returns the current event stream file's internal index for the device with the specified ID.
If this device is not registered with the event stream file, it will register it, potentially generating and registering it with the larger Metadata Devices list if needed.
func (*MetadataBuilder) Merge ¶
func (mb *MetadataBuilder) Merge(md *Metadata) error
Merge adds information from md to mb. Merge will mutate and reference md in the process; md should not be used after it has been passed to Merge.
If md is incompatible with mb, Merge will return an error and leave mb in an indeterminate state.
func (*MetadataBuilder) NumBytes ¶
func (mb *MetadataBuilder) NumBytes() int64
NumBytes returns the cumulative number of bytes recorded so far.
func (*MetadataBuilder) NumEvents ¶
func (mb *MetadataBuilder) NumEvents() int64
NumEvents returns the cumulative number of events recorded so far.
func (*MetadataBuilder) Offset ¶
func (mb *MetadataBuilder) Offset() time.Duration
Offset returns the current offset in the metadata builder.
func (*MetadataBuilder) RecordEvent ¶
func (mb *MetadataBuilder) RecordEvent(bytes int64, offset time.Duration)
RecordEvent updates event metadata.
func (*MetadataBuilder) Write ¶
func (mb *MetadataBuilder) Write(path string) error
Write writes the constructed metadata to the destination path.
type Metadata_EventFile ¶
type Metadata_EventFile struct { // name is the relative filename of this event file. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // Compression is the compression used for this event file. Compression Compression `protobuf:"varint,2,opt,name=compression,enum=streamfile.Compression" json:"compression,omitempty"` // A list of device indices in the event file. // // The event file uses internal indices to reference devices. Its internal // indices begin at 0, and map to devices in the Devices list. // // This is a list of those mappings, where the list index (0...n) is the // internal ID of that device and the list value is the index in the // Devices list. DeviceMapping []int64 `protobuf:"varint,3,rep,packed,name=device_mapping,json=deviceMapping" json:"device_mapping,omitempty"` // Duration is the total duration of the event stream. Duration *google_protobuf.Duration `protobuf:"bytes,4,opt,name=duration" json:"duration,omitempty"` // Total number of individual events in the file. NumEvents int64 `protobuf:"varint,5,opt,name=num_events,json=numEvents" json:"num_events,omitempty"` // Total number of bytes in the file. NumBytes int64 `protobuf:"varint,6,opt,name=num_bytes,json=numBytes" json:"num_bytes,omitempty"` }
Composite event files.
func (*Metadata_EventFile) Descriptor ¶
func (*Metadata_EventFile) Descriptor() ([]byte, []int)
func (*Metadata_EventFile) DeviceForInternalIndex ¶
func (efi *Metadata_EventFile) DeviceForInternalIndex(index int64, md *Metadata) *Device
DeviceForInternalIndex returns the device with the specified name, or nil if no such device exists.
func (*Metadata_EventFile) GetCompression ¶
func (m *Metadata_EventFile) GetCompression() Compression
func (*Metadata_EventFile) GetDeviceMapping ¶
func (m *Metadata_EventFile) GetDeviceMapping() []int64
func (*Metadata_EventFile) GetDuration ¶
func (m *Metadata_EventFile) GetDuration() *google_protobuf.Duration
func (*Metadata_EventFile) GetName ¶
func (m *Metadata_EventFile) GetName() string
func (*Metadata_EventFile) GetNumBytes ¶
func (m *Metadata_EventFile) GetNumBytes() int64
func (*Metadata_EventFile) GetNumEvents ¶
func (m *Metadata_EventFile) GetNumEvents() int64
func (*Metadata_EventFile) ProtoMessage ¶
func (*Metadata_EventFile) ProtoMessage()
func (*Metadata_EventFile) Reset ¶
func (m *Metadata_EventFile) Reset()
func (*Metadata_EventFile) String ¶
func (m *Metadata_EventFile) String() string
type Metadata_Version ¶
type Metadata_Version int32
Version is the version of this file format.
const ( // UNKNOWN is an unknown version. It is the enum's default value to catch // uninitialized enums. Metadata_UNKNOWN Metadata_Version = 0 // V_1 is the first (and only) version of this file. Metadata_V_1 Metadata_Version = 1 )
func (Metadata_Version) EnumDescriptor ¶
func (Metadata_Version) EnumDescriptor() ([]byte, []int)
func (Metadata_Version) String ¶
func (x Metadata_Version) String() string
type PixelPusherPixels ¶
type PixelPusherPixels struct { // The strip that the pixels are being sent to. StripNumber int32 `protobuf:"varint,1,opt,name=strip_number,json=stripNumber" json:"strip_number,omitempty"` // The raw pixel data for this strip. PixelData []byte `protobuf:"bytes,2,opt,name=pixel_data,json=pixelData,proto3" json:"pixel_data,omitempty"` }
PixelPusherPixels is a set-pixels message for a single strip on a device.
The actual pixel bytes are the raw pixel bitmap for the strip. Their meaning depends on the strip's pixel encoding.
func (*PixelPusherPixels) Descriptor ¶
func (*PixelPusherPixels) Descriptor() ([]byte, []int)
func (*PixelPusherPixels) GetPixelData ¶
func (m *PixelPusherPixels) GetPixelData() []byte
func (*PixelPusherPixels) GetStripNumber ¶
func (m *PixelPusherPixels) GetStripNumber() int32
func (*PixelPusherPixels) ProtoMessage ¶
func (*PixelPusherPixels) ProtoMessage()
func (*PixelPusherPixels) Reset ¶
func (m *PixelPusherPixels) Reset()
func (*PixelPusherPixels) String ¶
func (m *PixelPusherPixels) String() string