Documentation ¶
Overview ¶
Package readers provides implementation for common reader types
- Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
Index ¶
- Constants
- type ParamReader
- type Reader
- func NewBytesReader(buf []byte) Reader
- func NewFileReader(filepath, name string, size int64, cksumType string) (Reader, error)
- func NewFileReaderFromFile(fn, cksumType string) (Reader, error)
- func NewRandReader(size int64, cksumType string) (Reader, error)
- func NewReader(p ParamReader, cksumType string) (Reader, error)
- func NewSGReader(sgl *memsys.SGL, size int64, cksumType string) (Reader, error)
- func NewTarReader(size int64, cksumType string) (r Reader, err error)
Constants ¶
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 ¶
Reader is the interface a client works with to read in data and send to a HTTP server
func NewBytesReader ¶
NewBytesReader returns a new bytesReader
func NewFileReader ¶
NewFileReader creates/opens the file, populates it with random data, and returns a new fileReader NOTE: Caller is responsible for closing.
func NewFileReaderFromFile ¶
NewFileReaderFromFile opens an existing file, reads it to compute checksum, and returns a new reader. NOTE: Caller responsible for closing.
func NewRandReader ¶
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 ¶
NewSGReader returns a new sgReader