Documentation ¶
Index ¶
- Constants
- func OpenReadStorage(sr dbcommon.StorageSeqReader, payloadFactory dbcommon.PayloadFactory, ...) (dbcommon.PayloadBuilder, error)
- func PrepareWriteStorage(sw dbcommon.StorageSeqWriter, options dbcommon.FormatOptions) (dbcommon.PayloadWriter, error)
- type StorageFileScheme
- type StorageFileV1
- type StorageFileV1Reader
- type StorageFileV1Writer
- func (p *StorageFileV1Writer) Close() error
- func (p *StorageFileV1Writer) WriteChapter(b []byte, details dbcommon.ChapterDetails) (dbcommon.StorageEntryPosition, error)
- func (p *StorageFileV1Writer) WriteConclude(b []byte) (dbcommon.StorageEntryPosition, error)
- func (p *StorageFileV1Writer) WritePrelude(b []byte, tailMaxPayloadLength int) (dbcommon.StorageEntryPosition, error)
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 ¶
func OpenReadStorage ¶
func OpenReadStorage(sr dbcommon.StorageSeqReader, payloadFactory dbcommon.PayloadFactory, config dbcommon.ReadConfig, options dbcommon.FormatOptions, ) (dbcommon.PayloadBuilder, error)
func PrepareWriteStorage ¶
func PrepareWriteStorage(sw dbcommon.StorageSeqWriter, options dbcommon.FormatOptions) (dbcommon.PayloadWriter, error)
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 ¶
func (p *StorageFileV1Reader) Read(sr dbcommon.StorageSeqReader) error
type StorageFileV1Writer ¶
type StorageFileV1Writer struct { StorageFileV1 // contains filtered or unexported fields }
func NewStorageFileV1Writer ¶
func NewStorageFileV1Writer(sw dbcommon.StorageSeqWriter, sf StorageFileV1) (*StorageFileV1Writer, error)
func (*StorageFileV1Writer) Close ¶
func (p *StorageFileV1Writer) Close() error
func (*StorageFileV1Writer) WriteChapter ¶
func (p *StorageFileV1Writer) WriteChapter(b []byte, details dbcommon.ChapterDetails) (dbcommon.StorageEntryPosition, error)
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)
Click to show internal directories.
Click to hide internal directories.