utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package utils provides functionality which is used by several other packages or by tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NoCopy

type NoCopy struct{}

NoCopy prevents copying structs by accident. Adding it to a struct will cause go vet to flag it as an error when you try to copy the struct. This is inspired by sync.noCopy which is used in several concurrency primitives but not publicly exposed.

func (*NoCopy) Lock

func (n *NoCopy) Lock()

func (*NoCopy) Unlock

func (n *NoCopy) Unlock()

type SegmentReaderFileLoop

type SegmentReaderFileLoop struct {
	Data   []byte
	Offset int
}

SegmentReaderFileLoop provides a stub for the segment file which returns the same data over and over again in an endless loop. It allows us to run large scale benchmarks without having to provide an actual big file on disk or memory.

func (*SegmentReaderFileLoop) Close

func (s *SegmentReaderFileLoop) Close() error

func (*SegmentReaderFileLoop) Name

func (s *SegmentReaderFileLoop) Name() string

func (*SegmentReaderFileLoop) Read

func (s *SegmentReaderFileLoop) Read(p []byte) (int, error)

func (*SegmentReaderFileLoop) Seek

func (s *SegmentReaderFileLoop) Seek(offset int64, whence int) (int64, error)

type SegmentWriterFileDiscard

type SegmentWriterFileDiscard struct{}

SegmentWriterFileDiscard provides a stub for a segment file which discards all data. It allows us to run large scale benchmarks without filling up the disk or memory.

func (*SegmentWriterFileDiscard) Close

func (s *SegmentWriterFileDiscard) Close() error

func (*SegmentWriterFileDiscard) Name

func (s *SegmentWriterFileDiscard) Name() string

func (*SegmentWriterFileDiscard) Sync

func (s *SegmentWriterFileDiscard) Sync() error

func (*SegmentWriterFileDiscard) Truncate

func (s *SegmentWriterFileDiscard) Truncate(offset int64) error

func (*SegmentWriterFileDiscard) Write

func (s *SegmentWriterFileDiscard) Write(p []byte) (int, error)

type SegmentWriterFileRecorder

type SegmentWriterFileRecorder struct {
	bytes.Buffer
}

SegmentWriterFileRecorder provides a stub for a segment file which records what is written to it in memory. It allows us to use a SegmentWriter to prepare a buffer which can then be used by SegmentReaderFileLoop to serve read requests.

func (*SegmentWriterFileRecorder) Close

func (s *SegmentWriterFileRecorder) Close() error

func (*SegmentWriterFileRecorder) Name

func (*SegmentWriterFileRecorder) Sync

func (s *SegmentWriterFileRecorder) Sync() error

func (*SegmentWriterFileRecorder) Truncate

func (s *SegmentWriterFileRecorder) Truncate(offset int64) error

Jump to

Keyboard shortcuts

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