segment

package
v0.0.0-...-a6f45d6 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKeyPrefix

func NewKeyPrefix(channelKey channel.Key) []byte

Types

type Header struct {
	ChannelKey channel.Key
	Start      telem.TimeStamp
	FileKey    core.FileKey
	Offset     telem.Offset
	Size       telem.Size
}

func (Header) End

func (Header) GorpKey

func (h Header) GorpKey() []byte

GorpKey implements the gorp.Entry interface.

func (Header) Key

func (h Header) Key() Key

func (Header) SetOptions

func (h Header) SetOptions() []interface{}

SetOptions implements the gorp.Entry interface.

func (Header) Sugar

func (h Header) Sugar(ch channel.Channel) *Sugared

type Key

type Key [11]byte

func NewKey

func NewKey(channelKey channel.Key, stamp telem.TimeStamp) (key Key)

func (Key) Bytes

func (k Key) Bytes() []byte

type Range

type Range struct {
	Channel channel.Channel
	Bounds  telem.TimeRange
	Headers []Header
}

func (*Range) Empty

func (r *Range) Empty() bool

func (*Range) Range

func (r *Range) Range() telem.TimeRange

func (*Range) UnboundedRange

func (r *Range) UnboundedRange() telem.TimeRange

type Segment

type Segment struct {
	ChannelKey channel.Key
	Start      telem.TimeStamp
	Data       []byte
}

func (Segment) Sugar

func (s Segment) Sugar(ch channel.Channel) *Sugared

type Sugared

type Sugared struct {
	// contains filtered or unexported fields
}

func (Sugared) BoundedOffset

func (s Sugared) BoundedOffset() telem.Offset

BoundedOffset returns the file offset of the underlying segment after being restricted by the bounds set in SetBounds.

func (Sugared) BoundedRange

func (s Sugared) BoundedRange() telem.TimeRange

BoundedRange returns the TimeRange of the underlying segment after being restricted by the bounds set in SetBounds.

func (Sugared) BoundedSize

func (s Sugared) BoundedSize() telem.Size

BoundedSize returns the size of the underlying segment's data in bytes after being restricted by the bounds set in SetBounds.

func (Sugared) BoundedSpan

func (s Sugared) BoundedSpan() telem.TimeSpan

BoundedSpan returns the TimeSpan of the underlying segment after being restricted by the bounds set in

func (Sugared) ChannelKey

func (s Sugared) ChannelKey() channel.Key

ChannelKey returns the key of the channel the segment belongs to.

func (Sugared) FileKey

func (s Sugared) FileKey() core.FileKey

FileKey returns the key of the file the segment belongs to.

func (*Sugared) Header

func (s *Sugared) Header() Header

Header returns the 'header' metadata for the segment.

func (*Sugared) ReadDataFrom

func (s *Sugared) ReadDataFrom(r io.ReaderAt) error

ReadDataFrom reads data from the reader into the underlying segment.

func (*Sugared) Segment

func (s *Sugared) Segment() Segment

Segment returns the underlying segment for the Sugared segment.

func (*Sugared) SetBounds

func (s *Sugared) SetBounds(bounds telem.TimeRange)

SetBounds restricts the segment to a particular time range. This is particularly useful for enabling partial segment reads.

func (*Sugared) SetFileKey

func (s *Sugared) SetFileKey(fk core.FileKey)

func (Sugared) Start

func (s Sugared) Start() telem.TimeStamp

func (Sugared) UnboundedRange

func (s Sugared) UnboundedRange() telem.TimeRange

UnboundedRange returns the time range of the underlying segment. This value is not restricted by any bounds set.

func (Sugared) UnboundedSize

func (s Sugared) UnboundedSize() telem.Size

UnboundedSize returns the size of the underlying segment's data in bytes. This value is not restricted by any bounds set.

func (Sugared) UnboundedSpan

func (s Sugared) UnboundedSpan() telem.TimeSpan

UnboundedSpan returns the TimeSpan of the underlying segment. This value is not restricted by any bounds set.

func (*Sugared) WriteDataTo

func (s *Sugared) WriteDataTo(w io.WriteSeeker) error

WriteDataTo writes the segment's data to the writer.

Jump to

Keyboard shortcuts

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