Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeDirtyList(buff []byte) (int, []uint, error)
- func DecodeDirtyListResponse(buff []byte) error
- func DecodeDontNeedAt(buff []byte) (int64, int32, error)
- func DecodeEventResponse(buff []byte) error
- func DecodeHashes(buff []byte) (map[uint][sha256.Size]byte, error)
- func DecodeHashesResponse(buff []byte) error
- func DecodeNeedAt(buff []byte) (int64, int32, error)
- func DecodeReadAt(buff []byte) (int64, int32, error)
- func DecodeRemoveDev(buff []byte) error
- func DecodeRemoveFromMap(buff []byte) ([]uint64, error)
- func DecodeWriteAt(buff []byte) (offset int64, data []byte, err error)
- func DecodeWriteAtComp(buff []byte) (offset int64, data []byte, err error)
- func DecodeWriteAtHash(buff []byte) (offset int64, length int64, hash []byte, err error)
- func DecodeWriteAtWithMap(buff []byte) (int64, []byte, map[uint64]uint64, error)
- func EncodeAlternateSources(sources []AlternateSource) []byte
- func EncodeDevInfo(di *DevInfo) []byte
- func EncodeDirtyList(blockSize int, blocks []uint) []byte
- func EncodeDirtyListResponse() []byte
- func EncodeDontNeedAt(offset int64, length int32) []byte
- func EncodeEvent(e *Event) []byte
- func EncodeEventResponse() []byte
- func EncodeHashes(hashes map[uint][sha256.Size]byte) []byte
- func EncodeHashesResponse() []byte
- func EncodeNeedAt(offset int64, length int32) []byte
- func EncodeReadAt(offset int64, length int32) []byte
- func EncodeReadAtResponse(rar *ReadAtResponse) []byte
- func EncodeRemoveDev() []byte
- func EncodeRemoveFromMap(ids []uint64) []byte
- func EncodeWriteAt(offset int64, data []byte) []byte
- func EncodeWriteAtComp(offset int64, data []byte) []byte
- func EncodeWriteAtHash(offset int64, length int64, hash []byte) []byte
- func EncodeWriteAtResponse(war *WriteAtResponse) []byte
- func EncodeWriteAtWithMap(offset int64, data []byte, idmap map[uint64]uint64) []byte
- func EncodeWriterWriteAt(offset int64, data []byte) (uint32, func(w io.Writer) error)
- func IsResponse(cmd byte) bool
- type AlternateSource
- type DevInfo
- type Event
- type EventType
- type ReadAtResponse
- type WriteAtResponse
Constants ¶
View Source
const ( CommandReadAt = CommandRequest | byte(1) CommandWriteAt = CommandRequest | byte(2) CommandNeedAt = CommandRequest | byte(3) CommandDontNeedAt = CommandRequest | byte(4) CommandDirtyList = CommandRequest | byte(5) CommandDevInfo = CommandRequest | byte(6) CommandEvent = CommandRequest | byte(7) CommandHashes = CommandRequest | byte(8) CommandWriteAtWithMap = CommandRequest | byte(9) CommandRemoveDev = CommandRequest | byte(10) CommandRemoveFromMap = CommandRequest | byte(11) CommandAlternateSources = CommandRequest | byte(12) )
View Source
const ( CommandReadAtResponse = CommandResponse | byte(1) CommandReadAtResponseErr = CommandResponse | byte(2) CommandWriteAtResponse = CommandResponse | byte(3) CommandWriteAtResponseErr = CommandResponse | byte(4) CommandEventResponse = CommandResponse | byte(5) CommandHashesResponse = CommandResponse | byte(6) CommandDirtyListResponse = CommandResponse | byte(7) )
View Source
const CommandRequest = byte(0)
View Source
const CommandResponse = byte(0x80)
View Source
const EventCompleted = EventType(4)
View Source
const EventCustom = EventType(5)
View Source
const EventPostLock = EventType(1)
View Source
const EventPostUnlock = EventType(3)
View Source
const EventPreLock = EventType(0)
View Source
const EventPreUnlock = EventType(2)
View Source
const WriteAtCompRLE = 2
View Source
const WriteAtData = 0
View Source
const WriteAtHash = 1
Variables ¶
View Source
var ErrInvalidPacket = errors.New("invalid packet")
View Source
var ErrReadError = errors.New("remote read error")
View Source
var ErrWriteError = errors.New("remote write error")
View Source
var EventsByType = map[EventType]string{ EventPreLock: "PreLock", EventPostLock: "PostLock", EventPreUnlock: "PreUnlock", EventPostUnlock: "PostUnlock", EventCompleted: "Completed", EventCustom: "Custom", }
Functions ¶
func DecodeDirtyListResponse ¶ added in v0.0.6
func DecodeEventResponse ¶
func DecodeHashesResponse ¶
func DecodeRemoveDev ¶ added in v0.0.6
func DecodeRemoveFromMap ¶ added in v0.0.6
func DecodeWriteAtHash ¶ added in v0.0.10
func DecodeWriteAtWithMap ¶ added in v0.0.6
func EncodeAlternateSources ¶ added in v0.0.10
func EncodeAlternateSources(sources []AlternateSource) []byte
func EncodeDevInfo ¶
func EncodeDirtyList ¶
func EncodeDirtyListResponse ¶ added in v0.0.6
func EncodeDirtyListResponse() []byte
func EncodeDontNeedAt ¶
func EncodeEvent ¶
func EncodeEventResponse ¶
func EncodeEventResponse() []byte
func EncodeHashesResponse ¶
func EncodeHashesResponse() []byte
func EncodeNeedAt ¶
func EncodeReadAt ¶
func EncodeReadAtResponse ¶
func EncodeReadAtResponse(rar *ReadAtResponse) []byte
func EncodeRemoveDev ¶ added in v0.0.6
func EncodeRemoveDev() []byte
func EncodeRemoveFromMap ¶ added in v0.0.6
func EncodeWriteAt ¶
func EncodeWriteAtComp ¶
func EncodeWriteAtHash ¶ added in v0.0.10
func EncodeWriteAtResponse ¶
func EncodeWriteAtResponse(war *WriteAtResponse) []byte
func EncodeWriteAtWithMap ¶ added in v0.0.6
func EncodeWriterWriteAt ¶
func IsResponse ¶
Types ¶
type AlternateSource ¶ added in v0.0.10
func DecodeAlternateSources ¶ added in v0.0.10
func DecodeAlternateSources(buff []byte) ([]AlternateSource, error)
type DevInfo ¶
func DecodeDevInfo ¶
type Event ¶
func DecodeEvent ¶
type ReadAtResponse ¶
func DecodeReadAtResponse ¶
func DecodeReadAtResponse(buff []byte) (*ReadAtResponse, error)
type WriteAtResponse ¶
func DecodeWriteAtResponse ¶
func DecodeWriteAtResponse(buff []byte) (*WriteAtResponse, error)
Click to show internal directories.
Click to hide internal directories.