datacapture

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package datacapture contains tools for interacting with Viam datacapture files.

Index

Constants

View Source
const (
	FileExt = ".capture"
)

FileExt defines the file extension for Viam data capture files.

Variables

This section is empty.

Functions

func BuildCaptureMetadata

func BuildCaptureMetadata(compType resource.SubtypeName, compName, compModel, method string,
	additionalParams map[string]string, tags []string,
) (*v1.DataCaptureMetadata, error)

BuildCaptureMetadata builds a DataCaptureMetadata object and returns error if additionalParams fails to convert to anypb map.

func GetFileExt added in v0.0.9

func GetFileExt(dataType v1.DataType, methodName string, parameters map[string]string) string

GetFileExt gets the file extension for a capture file.

func IsDataCaptureFile

func IsDataCaptureFile(f *os.File) bool

IsDataCaptureFile returns whether or not f is a data capture file.

Types

type File added in v0.1.6

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

File is the data structure containing data captured by collectors. It is backed by a file on disk containing length delimited protobuf messages, where the first message is the CaptureMetadata for the file, and ensuing messages contain the captured data.

func NewFile added in v0.1.6

func NewFile(captureDir string, md *v1.DataCaptureMetadata) (*File, error)

NewFile creates a new File with the specified md in the specified directory.

func ReadFile added in v0.1.6

func ReadFile(f *os.File) (*File, error)

ReadFile creates a File struct from a passed os.File previously constructed using NewFile.

func (*File) Close added in v0.1.6

func (f *File) Close() error

Close closes the file.

func (*File) Delete added in v0.1.6

func (f *File) Delete() error

Delete deletes the file.

func (*File) GetPath added in v0.1.6

func (f *File) GetPath() string

GetPath returns the path of the underlying os.File.

func (*File) ReadMetadata added in v0.1.6

func (f *File) ReadMetadata() *v1.DataCaptureMetadata

ReadMetadata reads and returns the metadata in f.

func (*File) ReadNext added in v0.1.6

func (f *File) ReadNext() (*v1.SensorData, error)

ReadNext returns the next SensorData reading.

func (*File) Size added in v0.1.6

func (f *File) Size() int64

Size returns the size of the file.

func (*File) Sync added in v0.1.6

func (f *File) Sync() error

Sync flushes any buffered writes to disk.

func (*File) WriteNext added in v0.1.6

func (f *File) WriteNext(data *v1.SensorData) error

WriteNext writes the next SensorData reading.

Jump to

Keyboard shortcuts

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