resultset

package
v0.0.0-...-3b98f14 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader is a reader for a ResultSet, starting at the first figit (offset = 0) to the end of the ResultSet. Reader automatically switches to the next object as necessary. Alternatively you can also use ReadAt to read a section of ResultSet. Must be created by NewReader() and the caller must Close() after use.

func (*Reader) Close

func (r *Reader) Close() error

Close closes the Reader.

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

Read reads len(p) bytes of packed digits at the current position. Read returns at the end of each block with error == nil. Callers should continue to call Read() if it needs more digits.

func (*Reader) ReadAt

func (r *Reader) ReadAt(p []byte, off int64) (int, error)

ReadAt reads len(p) bytes of packed digits starting at byte result offset (first byte in the result set is 0). Returns io.EOF at the end of the result set.

func (*Reader) ResultSet

func (r *Reader) ResultSet() ResultSet

ResultSet returns the underlying ResultSet.

func (*Reader) Seek

func (r *Reader) Seek(offset int64, whence int) (int64, error)

Seek sets the byte result offset for the next Read().

type ResultSet

type ResultSet []*ycd.YCDFile

ResultSet is a list of YCD files consisting the same pi calculation result.

func (ResultSet) BlockByteLength

func (s ResultSet) BlockByteLength() int64

BlockByteLength returns the byte length of each block.

func (ResultSet) BlockSize

func (s ResultSet) BlockSize() int64

BlockSize returns the number of digits in each block.

func (ResultSet) DigitsPerWord

func (s ResultSet) DigitsPerWord() int

DigitsPerWord returns the number of digits per word.

func (ResultSet) FirstDigit

func (s ResultSet) FirstDigit() byte

FirstDigit returns the first digit of the result.

func (ResultSet) Len

func (s ResultSet) Len() int

Len is the number of elements in the collection.

func (ResultSet) Less

func (s ResultSet) Less(i, j int) bool

Less reports whether the element with index i must sort before the element with index j.

func (ResultSet) NewReader

func (s ResultSet) NewReader(ctx context.Context, bucket obj.Bucket) *Reader

NewReader returns a new ResultSetReader with bucket.

func (ResultSet) OffsetToBlockPos

func (s ResultSet) OffsetToBlockPos(off int64) (blockID, blockOff int64)

OffSetToBlockPos converts the byte offset off to a set of blockID and blockOff.

func (ResultSet) Radix

func (s ResultSet) Radix() int

Radix returns the base of the result set.

func (ResultSet) Swap

func (s ResultSet) Swap(i, j int)

Swap swaps the elements with indexes i and j.

func (ResultSet) TotalByteLength

func (s ResultSet) TotalByteLength() int64

TotalByteLength returns the total byte length of the digits. It doesn't include headers.

func (ResultSet) TotalDigits

func (s ResultSet) TotalDigits() int64

TotalDigits returns the total number of digits in the array. y-cruncher doesn't seem to set TotalDigits unless a particular ycd file has a smaller number of digits smaller than the block size. If any file has the total digit field set, this simply returns the value of the field. Otherwise, it returns the sum of block sizes.

Jump to

Keyboard shortcuts

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