types

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrettyBlockNum

func PrettyBlockNum(b uint64) string

func RangeBoundaryNames

func RangeBoundaryNames() []string

RangeBoundaryNames returns a list of possible string values of RangeBoundary.

func RoundToBundleEndBlock

func RoundToBundleEndBlock(block, fileBlockSize uint64) uint64

func RoundToBundleStartBlock

func RoundToBundleStartBlock(block, fileBlockSize uint64) uint64

Types

type BlockNum

type BlockNum int64
var HeadBlockNum BlockNum = -1

func (BlockNum) String

func (b BlockNum) String() string

type BlockRange

type BlockRange struct {
	Start int64
	Stop  *uint64
}

BlockRange is actually an UnresolvedBlockRange so both the start and end could be negative values.

This is in opposition to `bstream.Range` which is a resolved range meaning that start/stop values will never be negative.

func GetBlockRangeFromArg

func GetBlockRangeFromArg(in string) (out BlockRange, err error)

func GetBlockRangeFromFlag

func GetBlockRangeFromFlag(cmd *cobra.Command, flagName string) (out BlockRange, err error)

func NewClosedRange

func NewClosedRange(start int64, stop uint64) BlockRange

func NewOpenRange

func NewOpenRange(start int64) BlockRange

func ParseBlockRange

func ParseBlockRange(input string, firstStreamableBlock uint64) (out BlockRange, err error)

func (BlockRange) BlockCount

func (b BlockRange) BlockCount() int64

func (BlockRange) Contains

func (b BlockRange) Contains(blockNum uint64, endBoundary RangeBoundary) bool

func (BlockRange) GetStartBlock

func (b BlockRange) GetStartBlock() int64

func (BlockRange) GetStopBlockOr

func (b BlockRange) GetStopBlockOr(defaultIfOpenRange uint64) uint64

func (BlockRange) IsClosed

func (b BlockRange) IsClosed() bool

func (BlockRange) IsOpen

func (b BlockRange) IsOpen() bool

func (BlockRange) IsResolved

func (b BlockRange) IsResolved() bool

IsResolved returns true if the range is both closed and fully resolved (e.g. both start and stop are positive values). Returns false otherwise.

func (BlockRange) ReprocRange

func (b BlockRange) ReprocRange() string

func (BlockRange) Split

func (b BlockRange) Split(chunkSize uint64, endBoundary RangeBoundary) ([]BlockRange, error)

func (BlockRange) String

func (b BlockRange) String() string

func (BlockRange) ToBstreamRange

func (b BlockRange) ToBstreamRange(endBoundary RangeBoundary) *bstream.Range

type RangeBoundary

type RangeBoundary int

ENUM(

Inclusive
Exclusive

)

const (
	EndBoundaryInclusive RangeBoundary = RangeBoundaryInclusive
	EndBoundaryExclusive               = RangeBoundaryExclusive
)
const (
	// RangeBoundaryInclusive is a RangeBoundary of type Inclusive.
	RangeBoundaryInclusive RangeBoundary = iota
	// RangeBoundaryExclusive is a RangeBoundary of type Exclusive.
	RangeBoundaryExclusive
)

func ParseRangeBoundary

func ParseRangeBoundary(name string) (RangeBoundary, error)

ParseRangeBoundary attempts to convert a string to a RangeBoundary

func (RangeBoundary) MarshalText

func (x RangeBoundary) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method

func (RangeBoundary) String

func (x RangeBoundary) String() string

String implements the Stringer interface.

func (*RangeBoundary) UnmarshalText

func (x *RangeBoundary) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method

Jump to

Keyboard shortcuts

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