utils

package
v0.0.0-...-aa4c645 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SizeRecordLength = 8
	SizeOpcode       = 1
	SizeDataEnd      = 4
	SizeFooter       = 8 + 8 + 4
	SizeMagic        = 8
)

Variables

This section is empty.

Functions

func AmendMCAP

func AmendMCAP(
	wsc io.ReadWriteSeeker,
	attachments []*mcap.Attachment,
	metadata []*mcap.Metadata,
) error

AmendMCAP adds attachment and metadata records to the end of the data section of an existing MCAP, in place. It then writes a new summary section consisting of the existing summary section, plus new attachment and metadata index records as applicable, with all offsets and CRCs updated to account for the new data.

func DefaultString

func DefaultString(strings ...string) string

DefaultString returns the first of the provided strings that is nonempty, or an empty string if they are all empty.

func FormatTable

func FormatTable(w io.Writer, rows [][]string)

func GetReader

func GetReader(ctx context.Context, filename string) (func() error, io.ReadSeekCloser, error)

func GetScheme

func GetScheme(filename string) (match1 string, match2 string, match3 string)

func Keys

func Keys[T any](m map[string]T) []string

func NewProgressBar

func NewProgressBar(max int64) *progressbar.ProgressBar

NewProgressBar returns an instance of progressbar.ProgresBar. `max` is the denominator of the progress.

func PrettyJSON

func PrettyJSON(data []byte) (string, error)

func ReadingStdin

func ReadingStdin() (bool, error)

func StdoutRedirected

func StdoutRedirected() bool

func WithReader

func WithReader(ctx context.Context, filename string, f func(remote bool, rs io.ReadSeeker) error) error

Types

type GCSReadSeekCloser

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

func NewGCSReadSeekCloser

func NewGCSReadSeekCloser(ctx context.Context, object *storage.ObjectHandle) (*GCSReadSeekCloser, error)

func (*GCSReadSeekCloser) Close

func (r *GCSReadSeekCloser) Close() error

func (*GCSReadSeekCloser) Read

func (r *GCSReadSeekCloser) Read(p []byte) (int, error)

func (*GCSReadSeekCloser) Seek

func (r *GCSReadSeekCloser) Seek(offset int64, whence int) (int64, error)

type PriorityQueue

type PriorityQueue []TaggedMessage

func NewPriorityQueue

func NewPriorityQueue(msgs []TaggedMessage) *PriorityQueue

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() any

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x any)

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

type TaggedMessage

type TaggedMessage struct {
	Message *mcap.Message
	InputID int
}

TaggedMessage is an mcap message, tagged with an identifier for the input it came from.

func NewTaggedMessage

func NewTaggedMessage(inputID int, msg *mcap.Message) TaggedMessage

Jump to

Keyboard shortcuts

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