Documentation ¶
Index ¶
- Constants
- func CreateTar(w io.Writer, r *io.LimitedReader)
- func Handler(w http.ResponseWriter, r *http.Request)
- func MakeDir(name string)
- func TimeTrack(start time.Time, name string)
- type BufferTarInterpreter
- type FileLzWriter
- type FileReaderMaker
- type FileTarBall
- func (fb *FileTarBall) BaseDir() string
- func (fb *FileTarBall) CloseTar() error
- func (fb *FileTarBall) Finish() error
- func (fb *FileTarBall) Nop() bool
- func (fb *FileTarBall) Number() int
- func (fb *FileTarBall) SetSize(i int64)
- func (fb *FileTarBall) SetUp(names ...string)
- func (fb *FileTarBall) Size() int64
- func (fb *FileTarBall) Trim() string
- func (fb *FileTarBall) Tw() *tar.Writer
- type FileTarBallMaker
- type HTTPReaderMaker
- type LzopReader
- type NOPTarBall
- func (n *NOPTarBall) BaseDir() string
- func (n *NOPTarBall) CloseTar() error
- func (n *NOPTarBall) Finish() error
- func (n *NOPTarBall) Nop() bool
- func (n *NOPTarBall) Number() int
- func (n *NOPTarBall) SetSize(i int64)
- func (n *NOPTarBall) SetUp(params ...string)
- func (n *NOPTarBall) Size() int64
- func (n *NOPTarBall) Trim() string
- func (n *NOPTarBall) Tw() *tar.Writer
- type NOPTarBallMaker
- type NOPTarInterpreter
- type StrideByteReader
Constants ¶
const LzopBlockSize = 256 * 1024
LzopBlockSize for modern architectures.
const LzopPrefix = "\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a\x10\x30\x20\xa0\x09\x40" +
"\x01\x05\x03\x00\x00\x01\x00\x00\x81\xa4\x59\x43\x06\xd0\x00" +
"\x00\x00\x00\x06\x70\x32\x2e\x74\x61\x72\x51\xf8\x06\x08"
LzopPrefix consists of arbitrary bytes at a specified length to satisfy lzop header format.
Variables ¶
This section is empty.
Functions ¶
func CreateTar ¶
func CreateTar(w io.Writer, r *io.LimitedReader)
CreateTar creates a new tarball from the passed in reader and writes to a destination writer.
func Handler ¶
func Handler(w http.ResponseWriter, r *http.Request)
Handler allows for generation of random bytes by configuring the URL 'https://localhost:8080/stride-N.bytes-N.tar.lzo' where byte size and stride length are customizable.
Compressed tar files are automatically generated. Grab using curl ie. 'curl -sk ...'
Types ¶
type BufferTarInterpreter ¶
type BufferTarInterpreter struct {
Out []byte
}
BufferTarInterpreter extracts data to a byte slice. Used for testing purposes.
type FileLzWriter ¶
FileLzWriter takes in input and compresses it to local disk.
func (*FileLzWriter) Compress ¶
func (f *FileLzWriter) Compress()
Compress uses lz4 to compress bytes to disk.
func (*FileLzWriter) Writer ¶
func (f *FileLzWriter) Writer() io.WriteCloser
Writer creates a new FileLzWriter.
type FileReaderMaker ¶
FileReaderMaker decompresses lzop tarballs from the passed in file.
func (*FileReaderMaker) Format ¶
func (f *FileReaderMaker) Format() string
func (*FileReaderMaker) Path ¶
func (f *FileReaderMaker) Path() string
func (*FileReaderMaker) Reader ¶
func (f *FileReaderMaker) Reader() (io.ReadCloser, error)
Reader creates a new reader from the passed in file.
type FileTarBall ¶
type FileTarBall struct {
// contains filtered or unexported fields
}
FileTarBall represents a tarball that is written to disk.
func (*FileTarBall) BaseDir ¶
func (fb *FileTarBall) BaseDir() string
func (*FileTarBall) CloseTar ¶
func (fb *FileTarBall) CloseTar() error
CloseTar closes the tar writer and file, flushing any unwritten data to the file before closing.
func (*FileTarBall) Finish ¶
func (fb *FileTarBall) Finish() error
Finish alerts that compression is complete.
func (*FileTarBall) Nop ¶
func (fb *FileTarBall) Nop() bool
func (*FileTarBall) Number ¶
func (fb *FileTarBall) Number() int
func (*FileTarBall) SetSize ¶
func (fb *FileTarBall) SetSize(i int64)
func (*FileTarBall) SetUp ¶
func (fb *FileTarBall) SetUp(names ...string)
SetUp creates a new LZ4 writer, tar writer and file for writing bundled compressed bytes to.
func (*FileTarBall) Size ¶
func (fb *FileTarBall) Size() int64
func (*FileTarBall) Trim ¶
func (fb *FileTarBall) Trim() string
func (*FileTarBall) Tw ¶
func (fb *FileTarBall) Tw() *tar.Writer
type FileTarBallMaker ¶
type FileTarBallMaker struct { BaseDir string Trim string Out string // contains filtered or unexported fields }
FileTarBallMaker creates a new FileTarBall with the directory that files should be extracted to.
func (*FileTarBallMaker) Make ¶
func (f *FileTarBallMaker) Make() walg.TarBall
Make creates a new FileTarBall.
type HTTPReaderMaker ¶
HTTPReaderMaker decompresses lzop tarballs from the passed in url.
func (*HTTPReaderMaker) Format ¶
func (h *HTTPReaderMaker) Format() string
func (*HTTPReaderMaker) Path ¶
func (h *HTTPReaderMaker) Path() string
func (*HTTPReaderMaker) Reader ¶
func (h *HTTPReaderMaker) Reader() (io.ReadCloser, error)
Reader creates a new request to grab the data generated by the random bytes generator.
type LzopReader ¶
LzopReader takes in uncompressed bytes and compresses using lzo.
type NOPTarBall ¶
type NOPTarBall struct {
// contains filtered or unexported fields
}
NOPTarBall mocks a tarball. Used for testing purposes.
func (*NOPTarBall) BaseDir ¶
func (n *NOPTarBall) BaseDir() string
func (*NOPTarBall) CloseTar ¶
func (n *NOPTarBall) CloseTar() error
func (*NOPTarBall) Finish ¶
func (n *NOPTarBall) Finish() error
func (*NOPTarBall) Nop ¶
func (n *NOPTarBall) Nop() bool
func (*NOPTarBall) Number ¶
func (n *NOPTarBall) Number() int
func (*NOPTarBall) SetSize ¶
func (n *NOPTarBall) SetSize(i int64)
func (*NOPTarBall) SetUp ¶
func (n *NOPTarBall) SetUp(params ...string)
func (*NOPTarBall) Size ¶
func (n *NOPTarBall) Size() int64
func (*NOPTarBall) Trim ¶
func (n *NOPTarBall) Trim() string
func (*NOPTarBall) Tw ¶
func (n *NOPTarBall) Tw() *tar.Writer
type NOPTarBallMaker ¶
type NOPTarBallMaker struct { BaseDir string Trim string Nop bool // contains filtered or unexported fields }
NOPTarBallMaker creates a new NOPTarBall. Used for testing purposes.
func (*NOPTarBallMaker) Make ¶
func (n *NOPTarBallMaker) Make() walg.TarBall
Make creates a new NOPTarBall.
type StrideByteReader ¶
type StrideByteReader struct {
// contains filtered or unexported fields
}
StrideByteReader allows for customizable "strides" of random bytes. Creates an infinite stream.
func NewStrideByteReader ¶
func NewStrideByteReader(s int) *StrideByteReader
NewStrideByteReader creates a new random byte stride generator with a seed of 0.