syncthing/lib/db/leveldb_xdr.go

143 lines
3.7 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 (
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ /
2016-02-02 11:44:33 +00:00
\ device (length + padded data) \
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
}
*/
2016-02-02 11:44:33 +00:00
func (o fileVersion) XDRSize() int {
return o.version.XDRSize() +
4 + len(o.device) + xdr.Padding(len(o.device))
2014-07-06 12:46:48 +00:00
}
2014-10-21 06:40:05 +00:00
func (o fileVersion) MarshalXDR() ([]byte, error) {
2016-02-02 11:44:33 +00:00
buf := make([]byte, o.XDRSize())
m := &xdr.Marshaller{Data: buf}
return buf, o.MarshalXDRInto(m)
}
2014-10-21 06:40:05 +00:00
func (o fileVersion) MustMarshalXDR() []byte {
bs, err := o.MarshalXDR()
if err != nil {
panic(err)
}
return bs
}
2016-02-02 11:44:33 +00:00
func (o fileVersion) MarshalXDRInto(m *xdr.Marshaller) error {
if err := o.version.MarshalXDRInto(m); err != nil {
return err
2015-03-25 21:37:35 +00:00
}
2016-02-02 11:44:33 +00:00
m.MarshalBytes(o.device)
return m.Error
2014-07-06 12:46:48 +00:00
}
func (o *fileVersion) UnmarshalXDR(bs []byte) error {
2016-02-02 11:44:33 +00:00
u := &xdr.Unmarshaller{Data: bs}
return o.UnmarshalXDRFrom(u)
2014-07-06 12:46:48 +00:00
}
2016-02-02 11:44:33 +00:00
func (o *fileVersion) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
(&o.version).UnmarshalXDRFrom(u)
o.device = u.UnmarshalBytes()
return u.Error
2014-07-06 12:46:48 +00:00
}
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<>;
}
*/
2016-02-02 11:44:33 +00:00
func (o versionList) XDRSize() int {
return 4 + xdr.SizeOfSlice(o.versions)
2014-07-06 12:46:48 +00:00
}
2014-10-21 06:40:05 +00:00
func (o versionList) MarshalXDR() ([]byte, error) {
2016-02-02 11:44:33 +00:00
buf := make([]byte, o.XDRSize())
m := &xdr.Marshaller{Data: buf}
return buf, o.MarshalXDRInto(m)
}
2014-10-21 06:40:05 +00:00
func (o versionList) MustMarshalXDR() []byte {
bs, err := o.MarshalXDR()
if err != nil {
panic(err)
}
return bs
}
2016-02-02 11:44:33 +00:00
func (o versionList) MarshalXDRInto(m *xdr.Marshaller) error {
m.MarshalUint32(uint32(len(o.versions)))
2014-07-06 12:46:48 +00:00
for i := range o.versions {
2016-02-02 11:44:33 +00:00
if err := o.versions[i].MarshalXDRInto(m); err != nil {
return err
}
2014-07-06 12:46:48 +00:00
}
2016-02-02 11:44:33 +00:00
return m.Error
2014-07-06 12:46:48 +00:00
}
func (o *versionList) UnmarshalXDR(bs []byte) error {
2016-02-02 11:44:33 +00:00
u := &xdr.Unmarshaller{Data: bs}
return o.UnmarshalXDRFrom(u)
2014-07-06 12:46:48 +00:00
}
2016-02-02 11:44:33 +00:00
func (o *versionList) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
_versionsSize := int(u.UnmarshalUint32())
2015-04-08 12:44:47 +00:00
if _versionsSize < 0 {
return xdr.ElementSizeExceeded("versions", _versionsSize, 0)
2016-02-02 11:44:33 +00:00
} else if _versionsSize == 0 {
o.versions = nil
} else {
if _versionsSize <= len(o.versions) {
o.versions = o.versions[:_versionsSize]
} else {
o.versions = make([]fileVersion, _versionsSize)
}
for i := range o.versions {
(&o.versions[i]).UnmarshalXDRFrom(u)
}
2015-04-08 12:44:47 +00:00
}
2016-02-02 11:44:33 +00:00
return u.Error
2014-07-06 12:46:48 +00:00
}