Documentation
¶
Index ¶
- Constants
- Variables
- func Assert(c bool, msg string)
- func Assertf(c bool, format string, args ...interface{})
- func Fuzz(odata []byte) int
- func GenDelta(dstSig io.Reader, src io.ReadSeeker, srcLen int64, result io.Writer, ...) (err error)
- func GenSign(rd io.Reader, rdLen int64, blockLen uint32, result io.Writer) (err error)
- func Htonl(l uint32) []byte
- func Htonll(ll uint64) []byte
- func Htons(s uint16) []byte
- func NewRotateBuffer(total int64, blockLen uint32, rd io.Reader) *rotateBuffer
- func Patch(deltaRd io.Reader, target io.ReadSeeker, merged io.Writer, args ...bool) (err error)
- func PatchSelf(deltaRd io.Reader, target io.ReadWriteSeeker, args ...bool) (err error)
- type Patcher
- type SignHdr
- type Signature
Constants ¶
View Source
const ( DeltaMagic uint32 = 0x72730236 BlakeMagic uint32 = 0x72730137 Md4Magic uint32 = 0x72730136 TABLE_SIZE = (1 << 16) NULL_TAG = -1 )
View Source
const ( // RS_OP_LITERAL_Nx与librsync中的定义不同 // RS_OP_LITERAL_Nx = librsync RS_OP_LITERAL_Nx - 0x40 // 这样,使用高位字节来存储数据压缩方式 RS_OP_LITERAL_N1 uint8 = 0x01 RS_OP_LITERAL_N2 uint8 = 0x02 RS_OP_LITERAL_N4 uint8 = 0x03 RS_OP_LITERAL_N8 uint8 = 0x04 // 压缩方式 RS_COMPRESS_NONE uint8 = 0x00 RS_COMPRESS_BZIP2 uint8 = 0x10 RS_COMPRESS_GZIP uint8 = 0x20 RS_COMPRESS_LZW uint8 = 0x30 RS_COMPRESS_FLATE uint8 = 0x40 RS_OP_COPY_N1_N1 uint8 = 0x45 RS_OP_COPY_N1_N2 uint8 = 0x46 RS_OP_COPY_N1_N4 uint8 = 0x47 RS_OP_COPY_N1_N8 uint8 = 0x48 RS_OP_COPY_N2_N1 uint8 = 0x49 RS_OP_COPY_N2_N2 uint8 = 0x4a RS_OP_COPY_N2_N4 uint8 = 0x4b RS_OP_COPY_N2_N8 uint8 = 0x4c RS_OP_COPY_N4_N1 uint8 = 0x4d RS_OP_COPY_N4_N2 uint8 = 0x4e RS_OP_COPY_N4_N4 uint8 = 0x4f RS_OP_COPY_N4_N8 uint8 = 0x50 RS_OP_COPY_N8_N1 uint8 = 0x51 RS_OP_COPY_N8_N2 uint8 = 0x52 RS_OP_COPY_N8_N4 uint8 = 0x53 RS_OP_COPY_N8_N8 uint8 = 0x54 )
Variables ¶
View Source
var (
NotDeltaMagic = errors.New("Not delta file format: magic wrong")
)
Functions ¶
func Fuzz ¶
将输入的data随机分成两部分,一部分作为源,一部分作为目标,最终经过几个步骤后,目标与源相同 1 随机分为两部分, src, dst 2 对dst做signature, dst.sig 3 根据dst.sig和src做delta, dst-src.delta 4 使用dst-src.delta patch dst,得到新的target 5 比较target与src
func GenDelta ¶
func GenDelta(dstSig io.Reader, src io.ReadSeeker, srcLen int64, result io.Writer, args ...bool) (err error)
generate delta param:
dstSig: reader of dst signature file src: reader of src file srcLen: src file content length result: detla file writer
func NewRotateBuffer ¶
total: rotateBuffer's buffer size blockLen: rotateBuffer block size rd: reader, which should feed the rotate buffer
Types ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.