Documentation ¶
Index ¶
- Constants
- func ReedSolomonCorrect(arr []byte, checksumSize ...int) error
- type BinarySearch
- type CommentJSON
- type FileDescription
- type Rinzler
- func (r *Rinzler) Checksum16(bs []byte) uint16
- func (r *Rinzler) Checksum32(bs []byte) uint32
- func (r *Rinzler) Checksum8(bs []byte) uint8
- func (r *Rinzler) Compress(bs []byte, use_dict bool) []byte
- func (r *Rinzler) CreateRecord(bs []byte) []byte
- func (r *Rinzler) Decompress(bs []byte, use_dict bool) ([]byte, error)
- func (r *Rinzler) GetDataPosition(indexPos uint64) uint64
- func (r *Rinzler) LoadFile(filename string)
- func (r *Rinzler) NewBinarySearch(filename string, recordSize uint64, fieldSize uint64) *BinarySearch
- func (r *Rinzler) RSDecode(arr []byte, totalSegments int, checksumSegments int) ([]byte, error)
- func (r *Rinzler) RSEncode(arr []byte, totalSegments int, checksumSegments int, pad bool) ([]byte, error)
- func (r *Rinzler) ReadRecord(pos int64) []byte
- func (r *Rinzler) SearchLeftB(target int) int64
- func (r *Rinzler) SetDictionary(b []byte) error
Constants ¶
const ( BYTE_CHECKSUM = 1 LENGTH_MARKER = 2 RESERVED_BYTES = 2 )
Variables ¶
This section is empty.
Functions ¶
func ReedSolomonCorrect ¶
This function is currently unavailable (in progress...)
Types ¶
type BinarySearch ¶
type BinarySearch struct {
// contains filtered or unexported fields
}
func (*BinarySearch) CachePerformance ¶
func (b *BinarySearch) CachePerformance() float64
func (*BinarySearch) Search ¶
func (b *BinarySearch) Search(target string) int64
func (*BinarySearch) SearchLeft ¶
func (b *BinarySearch) SearchLeft(target string) int64
func (*BinarySearch) SearchRight ¶
func (b *BinarySearch) SearchRight(target string) int64
type CommentJSON ¶
type CommentJSON struct { Id string `json:"id"` Subreddit string `json:"subreddit"` Author string `json:"author"` Author_fullname string `json:"author_fullname"` Link string `json:"link_id"` Permalink string `json:"permalink"` Subreddit_id string `json:"subreddit_id"` Score int32 `json:"score"` Created_utc uint32 `json:"created_utc"` Retrieved_on uint32 `json:"retrieved_on"` Author_created_utc uint32 `json:"author_created_utc"` }
type FileDescription ¶
type Rinzler ¶
type Rinzler struct { DataFile *os.File Crc32table *crc32.Table ZstdCDict *gozstd.CDict ZstdDDict *gozstd.DDict ZstdCompressionLevel int DataSegments int ChecksumSegments int ZstdDictionary []byte ZstdMagicHeader []byte FileDescription FileDescription }
func (*Rinzler) Checksum16 ¶
Calculate a 16 bit checksum from the 16 LSB bits of a CRC32 checksum
func (*Rinzler) Checksum32 ¶
Calculate a Castagnoli CRC32 (Optimized for x86 SSE4.2 capable processors)
func (*Rinzler) CreateRecord ¶
This function wraps the compression and Reed Solomon encoding functions and creates a compressed record with error detection and correction capabilities
func (*Rinzler) Decompress ¶
Decompress a zstandard (zstd) compressed byte slice
func (*Rinzler) GetDataPosition ¶
func (*Rinzler) NewBinarySearch ¶
func (r *Rinzler) NewBinarySearch(filename string, recordSize uint64, fieldSize uint64) *BinarySearch
func (*Rinzler) RSDecode ¶
Decode a Reed Solomon Encoded byte string. This method will first check the available 8 bit checksum and return the record if the checksum matches the calculated checksum. Otherwise, corruption is assumed and the record is processed using the Berlekamp-Welch algorithm to detect the corrupted bits and repair the record
func (*Rinzler) RSEncode ¶
func (r *Rinzler) RSEncode(arr []byte, totalSegments int, checksumSegments int, pad bool) ([]byte, error)
This method encodes a byte string using Reed Solomon FEC. This adds redundant data so that error correction is possible if the record's data becomes corrupted.