Documentation ¶
Index ¶
- Constants
- Variables
- func BtoUint24(buf []byte) uint32
- func BtoUint40(buf []byte) uint64
- func BtoUint48(buf []byte) uint64
- func BtoUint64(buf []byte) uint64
- func FormatFilename_PubkeyToOffsetAndSize(epoch uint64, rootCid cid.Cid, network Network) string
- func IsFileNewFormat(path string) (bool, error)
- func IsFileOldFormat(file io.ReaderAt) (bool, error)
- func IsFileOldFormatByPath(path string) (bool, error)
- func IsOldMagic(magicBytes [8]byte) bool
- func IsValidNetwork(network Network) bool
- func Uint24tob(v uint32) []byte
- func Uint40tob(v uint64) []byte
- func Uint48tob(v uint64) []byte
- func Uint64tob(v uint64) []byte
- type CidToOffsetAndSize_Reader
- type CidToOffsetAndSize_Writer
- type Deprecated_CidToOffset_Reader
- type Metadata
- type Network
- type OffsetAndSize
- type PubkeyToOffsetAndSize_Reader
- type PubkeyToOffsetAndSize_Writer
- func (w *PubkeyToOffsetAndSize_Writer) Close() error
- func (w *PubkeyToOffsetAndSize_Writer) GetFilepath() string
- func (w *PubkeyToOffsetAndSize_Writer) Put(pk solana.PublicKey, offset uint64, size uint64) error
- func (w *PubkeyToOffsetAndSize_Writer) Seal(ctx context.Context, dstDir string) error
- func (w *PubkeyToOffsetAndSize_Writer) SealWithFilename(ctx context.Context, dstFilepath string) error
- type ReaderAtCloser
- type SigToCid_Reader
- type SigToCid_Writer
- type SlotToCid_Reader
- type SlotToCid_Writer
Constants ¶
const ( MaxUint24 = 1<<24 - 1 MaxUint40 = 1<<40 - 1 MaxUint48 = 1<<48 - 1 MaxUint64 = 1<<64 - 1 )
const ( // 6 bytes for offset (uint48, max 281.5 TB (terabytes)), // 3 bytes for size (uint24, max 16.7 MB (megabytes), which is plenty considering the max object size is ~1 MB) IndexValueSize_CidToOffsetAndSize = 6 + 3 )
const ( // 6 bytes for offset (uint48, max 281.5 TB (terabytes)), // 3 bytes for size (uint24, max 16.7 MB (megabytes), which is plenty considering the max object size is ~1 MB) IndexValueSize_PubkeyToOffsetAndSize = 6 + 3 )
const (
// 36 bytes for cid
IndexValueSize_SigToCid = 36
)
const (
// 36 bytes for cid
IndexValueSize_SlotToCid = 36
)
Variables ¶
var ( ErrInvalidNetwork = errors.New("invalid network") ErrInvalidRootCid = errors.New("invalid root cid") )
var Kind_CidToOffsetAndSize = []byte("cid-to-offset-and-size")
var Kind_PubkeyToOffsetAndSize = []byte("pubkey-to-offset-and-size")
var Kind_SigToCid = []byte("sig-to-cid")
var Kind_SlotToCid = []byte("slot-to-cid")
Functions ¶
func FormatFilename_PubkeyToOffsetAndSize ¶ added in v0.4.0
func IsFileNewFormat ¶
func IsFileOldFormatByPath ¶
func IsOldMagic ¶
func IsValidNetwork ¶
func Uint24tob ¶ added in v0.4.0
Uint24tob converts a uint32 to a 3-byte slice; panics if v > maxUint24.
func Uint40tob ¶ added in v0.4.0
Uint40tob converts a uint64 to a 5-byte slice; panics if v > maxUint40.
Types ¶
type CidToOffsetAndSize_Reader ¶
type CidToOffsetAndSize_Reader struct {
// contains filtered or unexported fields
}
func OpenWithReader_CidToOffsetAndSize ¶
func OpenWithReader_CidToOffsetAndSize(reader ReaderAtCloser) (*CidToOffsetAndSize_Reader, error)
func Open_CidToOffsetAndSize ¶
func Open_CidToOffsetAndSize(file string) (*CidToOffsetAndSize_Reader, error)
func (*CidToOffsetAndSize_Reader) Close ¶
func (r *CidToOffsetAndSize_Reader) Close() error
func (*CidToOffsetAndSize_Reader) Get ¶
func (r *CidToOffsetAndSize_Reader) Get(cid_ cid.Cid) (*OffsetAndSize, error)
func (*CidToOffsetAndSize_Reader) Meta ¶
func (r *CidToOffsetAndSize_Reader) Meta() *Metadata
Meta returns the metadata for the index.
func (*CidToOffsetAndSize_Reader) Prefetch ¶
func (r *CidToOffsetAndSize_Reader) Prefetch(b bool)
type CidToOffsetAndSize_Writer ¶
type CidToOffsetAndSize_Writer struct {
// contains filtered or unexported fields
}
func (*CidToOffsetAndSize_Writer) Close ¶
func (w *CidToOffsetAndSize_Writer) Close() error
func (*CidToOffsetAndSize_Writer) GetFilepath ¶
func (w *CidToOffsetAndSize_Writer) GetFilepath() string
GetFilepath returns the path to the sealed index file.
type Deprecated_CidToOffset_Reader ¶
type Deprecated_CidToOffset_Reader struct {
// contains filtered or unexported fields
}
func Deprecated_OpenWithReader_CidToOffset ¶
func Deprecated_OpenWithReader_CidToOffset(reader ReaderAtCloser) (*Deprecated_CidToOffset_Reader, error)
func Deprecated_Open_CidToOffset ¶
func Deprecated_Open_CidToOffset(file string) (*Deprecated_CidToOffset_Reader, error)
func (*Deprecated_CidToOffset_Reader) Close ¶
func (r *Deprecated_CidToOffset_Reader) Close() error
func (*Deprecated_CidToOffset_Reader) Get ¶
func (r *Deprecated_CidToOffset_Reader) Get(cid_ cid.Cid) (uint64, error)
Get returns the offset for the given cid.
func (*Deprecated_CidToOffset_Reader) Meta ¶
func (r *Deprecated_CidToOffset_Reader) Meta() *Metadata
Meta returns the metadata for the index.
func (*Deprecated_CidToOffset_Reader) Prefetch ¶
func (r *Deprecated_CidToOffset_Reader) Prefetch(b bool)
type Metadata ¶
func (*Metadata) AssertIndexKind ¶
Assert IndexKind is x.
func (*Metadata) AssertNetwork ¶
Assert Network is x.
func (*Metadata) AssertRootCid ¶
Assert RootCid is x.
type OffsetAndSize ¶
type OffsetAndSize struct { Offset uint64 // uint48, 6 bytes, max 281.5 TB (terabytes) Size uint64 // uint24, 3 bytes, max 16.7 MB (megabytes) }
func NewOffsetAndSize ¶
func NewOffsetAndSize(offset uint64, size uint64) *OffsetAndSize
func OffsetAndSizeSliceFromBytes ¶ added in v0.4.0
func OffsetAndSizeSliceFromBytes(buf []byte) ([]OffsetAndSize, error)
func (OffsetAndSize) Bytes ¶
func (oas OffsetAndSize) Bytes() []byte
Bytes returns the offset and size as a byte slice.
func (*OffsetAndSize) FromBytes ¶
func (oas *OffsetAndSize) FromBytes(buf []byte) error
FromBytes parses the offset and size from a byte slice.
func (*OffsetAndSize) IsValid ¶
func (oas *OffsetAndSize) IsValid() bool
IsValid returns true if the offset and size are valid.
type PubkeyToOffsetAndSize_Reader ¶ added in v0.4.0
type PubkeyToOffsetAndSize_Reader struct {
// contains filtered or unexported fields
}
func OpenWithReader_PubkeyToOffsetAndSize ¶ added in v0.4.0
func OpenWithReader_PubkeyToOffsetAndSize(reader ReaderAtCloser) (*PubkeyToOffsetAndSize_Reader, error)
func Open_PubkeyToOffsetAndSize ¶ added in v0.4.0
func Open_PubkeyToOffsetAndSize(file string) (*PubkeyToOffsetAndSize_Reader, error)
func (*PubkeyToOffsetAndSize_Reader) Close ¶ added in v0.4.0
func (r *PubkeyToOffsetAndSize_Reader) Close() error
func (*PubkeyToOffsetAndSize_Reader) Get ¶ added in v0.4.0
func (r *PubkeyToOffsetAndSize_Reader) Get(pk solana.PublicKey) (*OffsetAndSize, error)
func (*PubkeyToOffsetAndSize_Reader) Meta ¶ added in v0.4.0
func (r *PubkeyToOffsetAndSize_Reader) Meta() *Metadata
Meta returns the metadata for the index.
func (*PubkeyToOffsetAndSize_Reader) Prefetch ¶ added in v0.4.0
func (r *PubkeyToOffsetAndSize_Reader) Prefetch(b bool)
type PubkeyToOffsetAndSize_Writer ¶ added in v0.4.0
type PubkeyToOffsetAndSize_Writer struct {
// contains filtered or unexported fields
}
func NewWriter_PubkeyToOffsetAndSize ¶ added in v0.4.0
func NewWriter_PubkeyToOffsetAndSize( epoch uint64, rootCid cid.Cid, network Network, tmpDir string, ) (*PubkeyToOffsetAndSize_Writer, error)
func (*PubkeyToOffsetAndSize_Writer) Close ¶ added in v0.4.0
func (w *PubkeyToOffsetAndSize_Writer) Close() error
func (*PubkeyToOffsetAndSize_Writer) GetFilepath ¶ added in v0.4.0
func (w *PubkeyToOffsetAndSize_Writer) GetFilepath() string
GetFilepath returns the path to the sealed index file.
func (*PubkeyToOffsetAndSize_Writer) Put ¶ added in v0.4.0
func (w *PubkeyToOffsetAndSize_Writer) Put(pk solana.PublicKey, offset uint64, size uint64) error
func (*PubkeyToOffsetAndSize_Writer) Seal ¶ added in v0.4.0
func (w *PubkeyToOffsetAndSize_Writer) Seal(ctx context.Context, dstDir string) error
func (*PubkeyToOffsetAndSize_Writer) SealWithFilename ¶ added in v0.4.0
func (w *PubkeyToOffsetAndSize_Writer) SealWithFilename(ctx context.Context, dstFilepath string) error
type SigToCid_Reader ¶
type SigToCid_Reader struct {
// contains filtered or unexported fields
}
func OpenWithReader_SigToCid ¶
func OpenWithReader_SigToCid(reader ReaderAtCloser) (*SigToCid_Reader, error)
func OpenWithReader_SigToCid_Deprecated ¶
func OpenWithReader_SigToCid_Deprecated(reader ReaderAtCloser) (*SigToCid_Reader, error)
func Open_SigToCid ¶
func Open_SigToCid(filepath string) (*SigToCid_Reader, error)
func (*SigToCid_Reader) Close ¶
func (r *SigToCid_Reader) Close() error
func (*SigToCid_Reader) Get ¶
func (r *SigToCid_Reader) Get(sig solana.Signature) (cid.Cid, error)
func (*SigToCid_Reader) IsDeprecatedOldVersion ¶
func (r *SigToCid_Reader) IsDeprecatedOldVersion() bool
func (*SigToCid_Reader) Meta ¶
func (r *SigToCid_Reader) Meta() *Metadata
Meta returns the metadata for the index.
func (*SigToCid_Reader) Prefetch ¶
func (r *SigToCid_Reader) Prefetch(b bool)
type SigToCid_Writer ¶
type SigToCid_Writer struct {
// contains filtered or unexported fields
}
func NewWriter_SigToCid ¶
func (*SigToCid_Writer) Close ¶
func (w *SigToCid_Writer) Close() error
func (*SigToCid_Writer) GetFilepath ¶
func (w *SigToCid_Writer) GetFilepath() string
GetFilepath returns the path to the sealed index file.
func (*SigToCid_Writer) Put ¶
func (w *SigToCid_Writer) Put(sig solana.Signature, cid_ cid.Cid) error
type SlotToCid_Reader ¶
type SlotToCid_Reader struct {
// contains filtered or unexported fields
}
func OpenWithReader_SlotToCid ¶
func OpenWithReader_SlotToCid(reader ReaderAtCloser) (*SlotToCid_Reader, error)
func OpenWithReader_SlotToCid_Deprecated ¶
func OpenWithReader_SlotToCid_Deprecated(reader ReaderAtCloser) (*SlotToCid_Reader, error)
func Open_SlotToCid ¶
func Open_SlotToCid(filepath string) (*SlotToCid_Reader, error)
func (*SlotToCid_Reader) Close ¶
func (r *SlotToCid_Reader) Close() error
func (*SlotToCid_Reader) Get ¶
func (r *SlotToCid_Reader) Get(slot uint64) (cid.Cid, error)
func (*SlotToCid_Reader) IsDeprecatedOldVersion ¶
func (r *SlotToCid_Reader) IsDeprecatedOldVersion() bool
func (*SlotToCid_Reader) Meta ¶
func (r *SlotToCid_Reader) Meta() *Metadata
Meta returns the metadata for the index.
func (*SlotToCid_Reader) Prefetch ¶
func (r *SlotToCid_Reader) Prefetch(b bool)
type SlotToCid_Writer ¶
type SlotToCid_Writer struct {
// contains filtered or unexported fields
}
func NewWriter_SlotToCid ¶
func (*SlotToCid_Writer) Close ¶
func (w *SlotToCid_Writer) Close() error
func (*SlotToCid_Writer) GetFilepath ¶
func (w *SlotToCid_Writer) GetFilepath() string
GetFilepath returns the path to the sealed index file.
func (*SlotToCid_Writer) Put ¶
func (w *SlotToCid_Writer) Put(slot uint64, cid_ cid.Cid) error