syncthing/internal/db/leveldb_xdr.go

168 lines
4.2 KiB
Go
Raw Normal View History

2014-07-13 07:24:25 +00:00
// ************************************************************
// This file is automatically generated by genxdr. Do not edit.
// ************************************************************
package db
2014-07-06 12:46:48 +00:00
import (
"bytes"
"io"
2014-08-01 11:12:54 +00:00
"github.com/calmh/xdr"
2014-07-06 12:46:48 +00:00
)
2014-07-13 07:24:25 +00:00
/*
fileVersion Structure:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2015-03-25 21:37:35 +00:00
/ /
\ Vector Structure \
/ /
2014-07-13 07:24:25 +00:00
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Length of device |
2014-07-13 07:24:25 +00:00
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ /
\ device (variable length) \
2014-07-13 07:24:25 +00:00
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
struct fileVersion {
2015-03-25 21:37:35 +00:00
Vector version;
opaque device<>;
2014-07-13 07:24:25 +00:00
}
*/
2014-07-06 12:46:48 +00:00
func (o fileVersion) EncodeXDR(w io.Writer) (int, error) {
var xw = xdr.NewWriter(w)
2015-03-25 21:37:35 +00:00
return o.EncodeXDRInto(xw)
2014-07-06 12:46:48 +00:00
}
2014-10-21 06:40:05 +00:00
func (o fileVersion) MarshalXDR() ([]byte, error) {
return o.AppendXDR(make([]byte, 0, 128))
}
2014-10-21 06:40:05 +00:00
func (o fileVersion) MustMarshalXDR() []byte {
bs, err := o.MarshalXDR()
if err != nil {
panic(err)
}
return bs
}
func (o fileVersion) AppendXDR(bs []byte) ([]byte, error) {
var aw = xdr.AppendWriter(bs)
2014-07-06 12:46:48 +00:00
var xw = xdr.NewWriter(&aw)
2015-03-25 21:37:35 +00:00
_, err := o.EncodeXDRInto(xw)
2014-10-21 06:40:05 +00:00
return []byte(aw), err
2014-07-06 12:46:48 +00:00
}
2015-03-25 21:37:35 +00:00
func (o fileVersion) EncodeXDRInto(xw *xdr.Writer) (int, error) {
_, err := o.version.EncodeXDRInto(xw)
if err != nil {
return xw.Tot(), err
}
xw.WriteBytes(o.device)
2014-07-06 12:46:48 +00:00
return xw.Tot(), xw.Error()
}
func (o *fileVersion) DecodeXDR(r io.Reader) error {
xr := xdr.NewReader(r)
2015-03-25 21:37:35 +00:00
return o.DecodeXDRFrom(xr)
2014-07-06 12:46:48 +00:00
}
func (o *fileVersion) UnmarshalXDR(bs []byte) error {
var br = bytes.NewReader(bs)
var xr = xdr.NewReader(br)
2015-03-25 21:37:35 +00:00
return o.DecodeXDRFrom(xr)
2014-07-06 12:46:48 +00:00
}
2015-03-25 21:37:35 +00:00
func (o *fileVersion) DecodeXDRFrom(xr *xdr.Reader) error {
(&o.version).DecodeXDRFrom(xr)
o.device = xr.ReadBytes()
2014-07-06 12:46:48 +00:00
return xr.Error()
}
2014-07-13 07:24:25 +00:00
/*
versionList Structure:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Number of versions |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ /
\ Zero or more fileVersion Structures \
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
struct versionList {
fileVersion versions<>;
}
*/
2014-07-06 12:46:48 +00:00
func (o versionList) EncodeXDR(w io.Writer) (int, error) {
var xw = xdr.NewWriter(w)
2015-03-25 21:37:35 +00:00
return o.EncodeXDRInto(xw)
2014-07-06 12:46:48 +00:00
}
2014-10-21 06:40:05 +00:00
func (o versionList) MarshalXDR() ([]byte, error) {
return o.AppendXDR(make([]byte, 0, 128))
}
2014-10-21 06:40:05 +00:00
func (o versionList) MustMarshalXDR() []byte {
bs, err := o.MarshalXDR()
if err != nil {
panic(err)
}
return bs
}
func (o versionList) AppendXDR(bs []byte) ([]byte, error) {
var aw = xdr.AppendWriter(bs)
2014-07-06 12:46:48 +00:00
var xw = xdr.NewWriter(&aw)
2015-03-25 21:37:35 +00:00
_, err := o.EncodeXDRInto(xw)
2014-10-21 06:40:05 +00:00
return []byte(aw), err
2014-07-06 12:46:48 +00:00
}
2015-03-25 21:37:35 +00:00
func (o versionList) EncodeXDRInto(xw *xdr.Writer) (int, error) {
2014-07-06 12:46:48 +00:00
xw.WriteUint32(uint32(len(o.versions)))
for i := range o.versions {
2015-03-25 21:37:35 +00:00
_, err := o.versions[i].EncodeXDRInto(xw)
if err != nil {
return xw.Tot(), err
}
2014-07-06 12:46:48 +00:00
}
return xw.Tot(), xw.Error()
}
func (o *versionList) DecodeXDR(r io.Reader) error {
xr := xdr.NewReader(r)
2015-03-25 21:37:35 +00:00
return o.DecodeXDRFrom(xr)
2014-07-06 12:46:48 +00:00
}
func (o *versionList) UnmarshalXDR(bs []byte) error {
var br = bytes.NewReader(bs)
var xr = xdr.NewReader(br)
2015-03-25 21:37:35 +00:00
return o.DecodeXDRFrom(xr)
2014-07-06 12:46:48 +00:00
}
2015-03-25 21:37:35 +00:00
func (o *versionList) DecodeXDRFrom(xr *xdr.Reader) error {
2014-07-06 12:46:48 +00:00
_versionsSize := int(xr.ReadUint32())
2015-04-08 12:44:47 +00:00
if _versionsSize < 0 {
return xdr.ElementSizeExceeded("versions", _versionsSize, 0)
}
2014-07-06 12:46:48 +00:00
o.versions = make([]fileVersion, _versionsSize)
for i := range o.versions {
2015-03-25 21:37:35 +00:00
(&o.versions[i]).DecodeXDRFrom(xr)
2014-07-06 12:46:48 +00:00
}
return xr.Error()
}