func (link *Link) Add(start, length uint64) (id uint64, err error) {
	entry := make([]byte, 16)
	binary.BigEndian.PutUint64(entry[:8], start)
	binary.BigEndian.PutUint64(entry[8:], length)

	link.Lock()
	defer link.Unlock()

	var pos int64
	if pos, err = link.file.Seek(0, 2); nil != err {
		return
	}

	var n int
	if n, err = link.file.Write(entry); nil != err {
		return
	} else if 16 != n {
		err = ErrFailedToWrite16Bytes
		return
	}

	id = uint64(pos / 16)
	return
}
// Add an entry in the link.
Add an entry in the link.
// Add an entry in the link .
func (link *Link) Add(start, length uint64) (id uint64, err error) {
	entry := make([]byte, 16)
	binary.BigEndian.PutUint64(entry[:8], start)
	binary.BigEndian.PutUint64(entry[8:], length)
	link.Lock()
	defer link.Unlock()
	var pos int64
	if pos, err = link.file.Seek(0, 2); nil != err {
		return
	}
	var n int
	if n, err = link.file.Write(entry); nil != err {
		return
	} else if 16 != n {
		err = ErrFailedToWrite16Bytes
		return
	}
	id = uint64(pos / 16)
	return
}
func ( link * Link ) Add ( start , length uint64 ) ( id uint64 , err error ) { entry := make ( [ ] byte , 16 ) binary . BigEndian . PutUint64 ( entry [ : 8 ] , start ) binary . BigEndian . PutUint64 ( entry [ 8 : ] , length ) link . Lock ( ) defer link . Unlock ( ) var pos int64 if pos , err = link . file . Seek ( 0 , 2 ) ; nil != err { return } var n int if n , err = link . file . Write ( entry ) ; nil != err { return } else if 16 != n { err = ErrFailedToWrite16Bytes return } id = uint64 ( pos / 16 ) return }
Add an entry in the link.
Add an entry in the link .