readers

package
v1.3.16 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 13 Imported by: 1

Documentation

Overview

Package readers provides implementation for common reader types

  • Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.

Index

Constants

View Source
const (
	// ReaderTypeFile defines the name for file reader
	ReaderTypeFile = "file"
	// ReaderTypeSG defines the name for sg reader
	ReaderTypeSG = "sg"
	// ReaderTypeRand defines the name for rand reader
	ReaderTypeRand = "rand"
	// ReaderTypeTar defines the name for random TAR reader
	ReaderTypeTar = "tar"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ParamReader

type ParamReader struct {
	Type       string      // file | sg | inmem | rand
	SGL        *memsys.SGL // When Type == sg
	Path, Name string      // When Type == file; path and name of file to be created (if not already existing)
	Size       int64
}

ParamReader is used to pass in parameters when creating a new reader

type Reader

type Reader interface {
	cos.ReadOpenCloser
	io.Seeker
	Cksum() *cos.Cksum
}

Reader is the interface a client works with to read in data and send to a HTTP server

func NewBytesReader

func NewBytesReader(buf []byte) Reader

NewBytesReader returns a new bytesReader

func NewFileReader

func NewFileReader(filepath, name string, size int64, cksumType string) (Reader, error)

NewFileReader creates/opens the file, populates it with random data, and returns a new fileReader NOTE: Caller is responsible for closing.

func NewFileReaderFromFile

func NewFileReaderFromFile(fn, cksumType string) (Reader, error)

NewFileReaderFromFile opens an existing file, reads it to compute checksum, and returns a new reader. NOTE: Caller responsible for closing.

func NewRandReader

func NewRandReader(size int64, cksumType string) (Reader, error)

NewRandReader returns a new randReader

func NewReader

func NewReader(p ParamReader, cksumType string) (Reader, error)

NewReader returns a data reader; type of reader returned is based on the parameters provided

func NewSGReader

func NewSGReader(sgl *memsys.SGL, size int64, cksumType string) (Reader, error)

NewSGReader returns a new sgReader

func NewTarReader

func NewTarReader(size int64, cksumType string) (r Reader, err error)

Jump to

Keyboard shortcuts

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