dbsv1

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxHeadPayloadLength = maxHeadLength - minHeadLength - 3 // SizeVarint32(maxTailLength) - 1

	MaxTailPayloadLength = maxTailLength - minTailLength

	MaxChapterPayloadLength = maxChapterLength - minChapterLength - (protokit.MaxVarintSize - 1) // for EntryOptions

)
View Source
const (
	ChapterWithoutSelfCheckOption dbcommon.FormatOptions = 1 << iota
)
View Source
const FormatId dbcommon.FileFormat = 1

Variables

This section is empty.

Functions

Types

type StorageFileScheme

type StorageFileScheme struct {
	FormatVersionAndOptions uint64 `protobuf:"fixed64,16,req"` // != 0

	Head struct {
		MagicAndCRC  uint64 `protobuf:"fixed64,16,req"` // != 0, a number updated each time when a file is regenerated
		HeadMagicStr string `protobuf:"string,17,req"`  // = "insolar-head"

		TailLen uint32 `protobuf:"varint,19,req"` // must be defined at creation of a file

		HeadObj interface{}

		SelfChk uint64 `protobuf:"fixed64,2047,req"` // != 0, MUST be equal to byte len of this struct (we use fixed size here to make it easier to calculate)
	} `protobuf:"bytes,20,opt"` // required, and MUST be the second field in the file

	Entry struct {
		MagicAndCRC uint64 `protobuf:"fixed64,16,req"` // != 0, MUST match Head.Magic+EntrySeqNo

		EntryOptions uint32 `protobuf:"varint,19,req"`

		DataObj interface{}

		SelfChk uint64 `protobuf:"fixed64,2047,opt"` // != 0, MUST be equal to byte len of this struct (we use fixed size here to make it easier to calculate)
	} `protobuf:"bytes,20<N<2046,rep"` // can be multiple entries of different types

	AlignPadding []byte `protobuf:"bytes,2046,opt"` // optional, and MUST be the 2nd from the end

	Tail struct {
		MagicAndCRC      uint64 `protobuf:"fixed64,16,req"` // != 0, MUST match Head.Magic
		TailMagicStr     string `protobuf:"string,17,req"`  // = "insolar-tail"
		EntryCountAndCRC uint64 `protobuf:"fixed64,18,req"` //
		Padding          []byte `protobuf:"bytes,19,opt"`   // as the size of Tail structure must be defined at the creation of a file, padding is needed.

		TailObj interface{}

		SelfChk uint64 `protobuf:"fixed64,2047,req"` // != 0, MUST be equal to byte len of this struct (we use fixed size here to make it easier to calculate)
	} `protobuf:"bytes,2047,opt"` // required, and MUST be the last field in the file
}

This structure is intended for incremental/streamed write with some abilities to detect corruptions and to do self heal. MUST: Strict order of field

type StorageFileV1

type StorageFileV1 struct {
	StorageOptions dbcommon.FormatOptions
	MagicZero      uint32
	TailAlign      uint32
	CrcTable       *crc32.Table
}

func (*StorageFileV1) CheckOptions

func (p *StorageFileV1) CheckOptions() error

type StorageFileV1Reader

type StorageFileV1Reader struct {
	StorageFileV1
	Config  dbcommon.ReadConfig
	Builder dbcommon.PayloadBuilder
}

func (*StorageFileV1Reader) Read

type StorageFileV1Writer

type StorageFileV1Writer struct {
	StorageFileV1
	// contains filtered or unexported fields
}

func (*StorageFileV1Writer) Close

func (p *StorageFileV1Writer) Close() error

func (*StorageFileV1Writer) WriteChapter

func (*StorageFileV1Writer) WriteConclude

func (p *StorageFileV1Writer) WriteConclude(b []byte) (dbcommon.StorageEntryPosition, error)

func (*StorageFileV1Writer) WritePrelude

func (p *StorageFileV1Writer) WritePrelude(b []byte, tailMaxPayloadLength int) (dbcommon.StorageEntryPosition, error)

Jump to

Keyboard shortcuts

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