mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-10 07:11:08 +00:00
113 lines
3.5 KiB
Go
113 lines
3.5 KiB
Go
// ************************************************************
|
|
// This file is automatically generated by genxdr. Do not edit.
|
|
// ************************************************************
|
|
|
|
package db
|
|
|
|
import (
|
|
"bytes"
|
|
"io"
|
|
|
|
"github.com/calmh/xdr"
|
|
)
|
|
|
|
/*
|
|
|
|
FileInfoTruncated 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
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
| Length of Name |
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
/ /
|
|
\ Name (variable length) \
|
|
/ /
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
| Flags |
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
| |
|
|
+ Modified (64 bits) +
|
|
| |
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
| |
|
|
+ Version (64 bits) +
|
|
| |
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
| |
|
|
+ Local Version (64 bits) +
|
|
| |
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
| Num Blocks |
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
struct FileInfoTruncated {
|
|
string Name<8192>;
|
|
unsigned int Flags;
|
|
hyper Modified;
|
|
unsigned hyper Version;
|
|
unsigned hyper LocalVersion;
|
|
unsigned int NumBlocks;
|
|
}
|
|
|
|
*/
|
|
|
|
func (o FileInfoTruncated) EncodeXDR(w io.Writer) (int, error) {
|
|
var xw = xdr.NewWriter(w)
|
|
return o.encodeXDR(xw)
|
|
}
|
|
|
|
func (o FileInfoTruncated) MarshalXDR() ([]byte, error) {
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
}
|
|
|
|
func (o FileInfoTruncated) MustMarshalXDR() []byte {
|
|
bs, err := o.MarshalXDR()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return bs
|
|
}
|
|
|
|
func (o FileInfoTruncated) AppendXDR(bs []byte) ([]byte, error) {
|
|
var aw = xdr.AppendWriter(bs)
|
|
var xw = xdr.NewWriter(&aw)
|
|
_, err := o.encodeXDR(xw)
|
|
return []byte(aw), err
|
|
}
|
|
|
|
func (o FileInfoTruncated) encodeXDR(xw *xdr.Writer) (int, error) {
|
|
if l := len(o.Name); l > 8192 {
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 8192)
|
|
}
|
|
xw.WriteString(o.Name)
|
|
xw.WriteUint32(o.Flags)
|
|
xw.WriteUint64(uint64(o.Modified))
|
|
xw.WriteUint64(o.Version)
|
|
xw.WriteUint64(o.LocalVersion)
|
|
xw.WriteUint32(o.NumBlocks)
|
|
return xw.Tot(), xw.Error()
|
|
}
|
|
|
|
func (o *FileInfoTruncated) DecodeXDR(r io.Reader) error {
|
|
xr := xdr.NewReader(r)
|
|
return o.decodeXDR(xr)
|
|
}
|
|
|
|
func (o *FileInfoTruncated) UnmarshalXDR(bs []byte) error {
|
|
var br = bytes.NewReader(bs)
|
|
var xr = xdr.NewReader(br)
|
|
return o.decodeXDR(xr)
|
|
}
|
|
|
|
func (o *FileInfoTruncated) decodeXDR(xr *xdr.Reader) error {
|
|
o.Name = xr.ReadStringMax(8192)
|
|
o.Flags = xr.ReadUint32()
|
|
o.Modified = int64(xr.ReadUint64())
|
|
o.Version = xr.ReadUint64()
|
|
o.LocalVersion = xr.ReadUint64()
|
|
o.NumBlocks = xr.ReadUint32()
|
|
return xr.Error()
|
|
}
|