wiretype

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Overview

Package wiretype defines the encoding types for the ffs package. Most of this package is generated by the protocol buffer compiler from the schema in file/wiretype/wiretype.proto.

Index

Constants

This section is empty.

Variables

View Source
var (
	Stat_FileType_name = map[int32]string{
		0:   "REGULAR",
		1:   "DIRECTORY",
		2:   "SYMLINK",
		3:   "SOCKET",
		4:   "NAMED_PIPE",
		5:   "DEVICE",
		6:   "CHAR_DEVICE",
		404: "UNKNOWN",
	}
	Stat_FileType_value = map[string]int32{
		"REGULAR":     0,
		"DIRECTORY":   1,
		"SYMLINK":     2,
		"SOCKET":      3,
		"NAMED_PIPE":  4,
		"DEVICE":      5,
		"CHAR_DEVICE": 6,
		"UNKNOWN":     404,
	}
)

Enum value maps for Stat_FileType.

View Source
var File_wiretype_proto protoreflect.FileDescriptor

Functions

func Load

func Load(ctx context.Context, s Getter, key string, msg proto.Message) error

Load reads the specified blob from s and decodes it into msg.

func Save

func Save(ctx context.Context, s Putter, msg proto.Message) (string, error)

Save encodes msg in wire format and writes it to s, returning the storage key.

func ToBinary added in v0.0.2

func ToBinary(msg proto.Message) ([]byte, error)

ToBinary encodes msg in wire format and returns the bytes. This is a wrapper around proto.Marshal so the caller does not need to directly import the protobuf machinery.

Types

type Block

type Block struct {
	Bytes uint64 `protobuf:"varint,1,opt,name=bytes,proto3" json:"bytes,omitempty"` // the number of bytes in this block
	Key   []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`      // the storage key of the block data
	// contains filtered or unexported fields
}

A Block describes the size and storage key of a data blob.

func (*Block) Descriptor deprecated

func (*Block) Descriptor() ([]byte, []int)

Deprecated: Use Block.ProtoReflect.Descriptor instead.

func (*Block) GetBytes

func (x *Block) GetBytes() uint64

func (*Block) GetKey

func (x *Block) GetKey() []byte

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) ProtoReflect

func (x *Block) ProtoReflect() protoreflect.Message

func (*Block) Reset

func (x *Block) Reset()

func (*Block) String

func (x *Block) String() string

type Child

type Child struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Key  []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

A Child records the name and storage key of a child Node.

func (*Child) Descriptor deprecated

func (*Child) Descriptor() ([]byte, []int)

Deprecated: Use Child.ProtoReflect.Descriptor instead.

func (*Child) GetKey

func (x *Child) GetKey() []byte

func (*Child) GetName

func (x *Child) GetName() string

func (*Child) ProtoMessage

func (*Child) ProtoMessage()

func (*Child) ProtoReflect

func (x *Child) ProtoReflect() protoreflect.Message

func (*Child) Reset

func (x *Child) Reset()

func (*Child) String

func (x *Child) String() string

type Extent

type Extent struct {
	Base   uint64   `protobuf:"varint,1,opt,name=base,proto3" json:"base,omitempty"`   // the starting offset
	Bytes  uint64   `protobuf:"varint,2,opt,name=bytes,proto3" json:"bytes,omitempty"` // the number of bytes in this extent
	Blocks []*Block `protobuf:"bytes,3,rep,name=blocks,proto3" json:"blocks,omitempty"`
	// contains filtered or unexported fields
}

An Extent describes a single contiguous span of stored data.

func (*Extent) Descriptor deprecated

func (*Extent) Descriptor() ([]byte, []int)

Deprecated: Use Extent.ProtoReflect.Descriptor instead.

func (*Extent) GetBase

func (x *Extent) GetBase() uint64

func (*Extent) GetBlocks

func (x *Extent) GetBlocks() []*Block

func (*Extent) GetBytes

func (x *Extent) GetBytes() uint64

func (*Extent) ProtoMessage

func (*Extent) ProtoMessage()

func (*Extent) ProtoReflect

func (x *Extent) ProtoReflect() protoreflect.Message

func (*Extent) Reset

func (x *Extent) Reset()

func (*Extent) String

func (x *Extent) String() string

type Getter

type Getter interface {
	Get(context.Context, string) ([]byte, error)
}

Getter is the interface to storage used by the Load function.

type Index

type Index struct {
	TotalBytes uint64    `protobuf:"varint,1,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"`
	Extents    []*Extent `protobuf:"bytes,2,rep,name=extents,proto3" json:"extents,omitempty"` // multiple blocks
	Single     []byte    `protobuf:"bytes,3,opt,name=single,proto3" json:"single,omitempty"`   // a single block
	// contains filtered or unexported fields
}

An Index records the size and storage locations of file data.

func (*Index) Descriptor deprecated

func (*Index) Descriptor() ([]byte, []int)

Deprecated: Use Index.ProtoReflect.Descriptor instead.

func (*Index) GetExtents

func (x *Index) GetExtents() []*Extent

func (*Index) GetSingle

func (x *Index) GetSingle() []byte

func (*Index) GetTotalBytes

func (x *Index) GetTotalBytes() uint64

func (*Index) Normalize

func (x *Index) Normalize()

Normalize updates n in-place so that all fields are in canonical order.

func (*Index) ProtoMessage

func (*Index) ProtoMessage()

func (*Index) ProtoReflect

func (x *Index) ProtoReflect() protoreflect.Message

func (*Index) Reset

func (x *Index) Reset()

func (*Index) String

func (x *Index) String() string

type Node

type Node struct {
	Index    *Index   `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`                 // file contents
	Stat     *Stat    `protobuf:"bytes,2,opt,name=stat,proto3" json:"stat,omitempty"`                   // stat metadata (optional)
	XAttrs   []*XAttr `protobuf:"bytes,3,rep,name=x_attrs,json=xAttrs,proto3" json:"x_attrs,omitempty"` // extended attributes
	Children []*Child `protobuf:"bytes,4,rep,name=children,proto3" json:"children,omitempty"`           // child file pointers
	// contains filtered or unexported fields
}

A Node is the top-level encoding of a file.

func (*Node) Descriptor deprecated

func (*Node) Descriptor() ([]byte, []int)

Deprecated: Use Node.ProtoReflect.Descriptor instead.

func (*Node) GetChildren

func (x *Node) GetChildren() []*Child

func (*Node) GetIndex

func (x *Node) GetIndex() *Index

func (*Node) GetStat

func (x *Node) GetStat() *Stat

func (*Node) GetXAttrs

func (x *Node) GetXAttrs() []*XAttr

func (*Node) MarshalJSON

func (n *Node) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for a *Node, by delegating to the protojson marshaler. This allows a node to be encoded using the encoding/json package transparently.

func (*Node) Normalize

func (n *Node) Normalize()

Normalize updates n in-place so that all fields are in canonical order.

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) ProtoReflect

func (x *Node) ProtoReflect() protoreflect.Message

func (*Node) Reset

func (x *Node) Reset()

func (*Node) String

func (x *Node) String() string

type Object

type Object struct {

	// Types that are assignable to Value:
	//
	//	*Object_Node
	//	*Object_Root
	//	*Object_Index
	Value isObject_Value `protobuf_oneof:"value"`
	// A version marker for the stored object.
	// Currently 0 is the only known value.
	Version uint64 `protobuf:"varint,15,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

An Object is the top-level wrapper for encoded objects.

func (*Object) Descriptor deprecated

func (*Object) Descriptor() ([]byte, []int)

Deprecated: Use Object.ProtoReflect.Descriptor instead.

func (*Object) GetIndex

func (x *Object) GetIndex() *indexpb.Index

func (*Object) GetNode

func (x *Object) GetNode() *Node

func (*Object) GetRoot

func (x *Object) GetRoot() *Root

func (*Object) GetValue

func (m *Object) GetValue() isObject_Value

func (*Object) GetVersion

func (x *Object) GetVersion() uint64

func (*Object) ProtoMessage

func (*Object) ProtoMessage()

func (*Object) ProtoReflect

func (x *Object) ProtoReflect() protoreflect.Message

func (*Object) Reset

func (x *Object) Reset()

func (*Object) String

func (x *Object) String() string

type Object_Index

type Object_Index struct {
	Index *indexpb.Index `protobuf:"bytes,3,opt,name=index,proto3,oneof"` // a blob index
}

type Object_Node

type Object_Node struct {
	Node *Node `protobuf:"bytes,1,opt,name=node,proto3,oneof"` // a structured file object
}

type Object_Root

type Object_Root struct {
	Root *Root `protobuf:"bytes,2,opt,name=root,proto3,oneof"` // a root pointer
}

type Putter

type Putter interface {
	CASPut(context.Context, blob.CASPutOptions) (string, error)
}

Putter is the interface to storage used by the Save function.

type Root

type Root struct {

	// The storage key of the root of the tree.
	// The blob contains an Object holding a Node message.
	// This field must be non-empty for a root to be valid.
	FileKey []byte `protobuf:"bytes,1,opt,name=file_key,json=fileKey,proto3" json:"file_key,omitempty"`
	// A human-readable descriptive label for the root.
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	// The storage key of a blob index for the root.
	// The blob contains a Object holding an ffs.index.Index message.
	IndexKey []byte `protobuf:"bytes,4,opt,name=index_key,json=indexKey,proto3" json:"index_key,omitempty"`
	// contains filtered or unexported fields
}

A Root records the location of a root node of a file tree.

func (*Root) Descriptor deprecated

func (*Root) Descriptor() ([]byte, []int)

Deprecated: Use Root.ProtoReflect.Descriptor instead.

func (*Root) GetDescription

func (x *Root) GetDescription() string

func (*Root) GetFileKey

func (x *Root) GetFileKey() []byte

func (*Root) GetIndexKey

func (x *Root) GetIndexKey() []byte

func (*Root) MarshalJSON

func (r *Root) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for a *Root, by delegating to the protojson marshaler. This allows a node to be encoded using the encoding/json package transparently.

func (*Root) ProtoMessage

func (*Root) ProtoMessage()

func (*Root) ProtoReflect

func (x *Root) ProtoReflect() protoreflect.Message

func (*Root) Reset

func (x *Root) Reset()

func (*Root) String

func (x *Root) String() string

type Stat

type Stat struct {

	// The low-order 12 bits of this field hold the standard Unix permissions,
	// along with the sticky, setuid, and setgid bits. The rest are reserved and
	// must be set to zero. In binary:
	//
	//	           owner group other
	//	... +-+-+-+-----+-----+-----+   S: setuid
	//	    |S|G|T|r w x|r w x|r w x|   G: setgid
	//	... +-+-+-+-----+-----+-----+   T: sticky
	//	     B A 9     6     3     0  « bit
	Permissions uint32        `protobuf:"varint,1,opt,name=permissions,proto3" json:"permissions,omitempty"`
	FileType    Stat_FileType `protobuf:"varint,2,opt,name=file_type,json=fileType,proto3,enum=ffs.file.Stat_FileType" json:"file_type,omitempty"`
	ModTime     *Timestamp    `protobuf:"bytes,3,opt,name=mod_time,json=modTime,proto3" json:"mod_time,omitempty"`
	Owner       *Stat_Ident   `protobuf:"bytes,4,opt,name=owner,proto3" json:"owner,omitempty"`
	Group       *Stat_Ident   `protobuf:"bytes,5,opt,name=group,proto3" json:"group,omitempty"`
	// contains filtered or unexported fields
}

Stat records POSIX style file metadata. Other than the modification time, these metadata are not interpreted by the file plumbing, but are preserved for the benefit of external tools.

func (*Stat) Descriptor deprecated

func (*Stat) Descriptor() ([]byte, []int)

Deprecated: Use Stat.ProtoReflect.Descriptor instead.

func (*Stat) GetFileType

func (x *Stat) GetFileType() Stat_FileType

func (*Stat) GetGroup

func (x *Stat) GetGroup() *Stat_Ident

func (*Stat) GetModTime

func (x *Stat) GetModTime() *Timestamp

func (*Stat) GetOwner

func (x *Stat) GetOwner() *Stat_Ident

func (*Stat) GetPermissions

func (x *Stat) GetPermissions() uint32

func (*Stat) ProtoMessage

func (*Stat) ProtoMessage()

func (*Stat) ProtoReflect

func (x *Stat) ProtoReflect() protoreflect.Message

func (*Stat) Reset

func (x *Stat) Reset()

func (*Stat) String

func (x *Stat) String() string

type Stat_FileType

type Stat_FileType int32

A FileType abstracts the type of a file.

const (
	Stat_REGULAR     Stat_FileType = 0   // a regular file
	Stat_DIRECTORY   Stat_FileType = 1   // a directory
	Stat_SYMLINK     Stat_FileType = 2   // a symbolic link
	Stat_SOCKET      Stat_FileType = 3   // a Unix-domain socket
	Stat_NAMED_PIPE  Stat_FileType = 4   // a named pipe
	Stat_DEVICE      Stat_FileType = 5   // a (block) device file
	Stat_CHAR_DEVICE Stat_FileType = 6   // a (character) device file
	Stat_UNKNOWN     Stat_FileType = 404 // nothing is known about the type of this file
)

func (Stat_FileType) Descriptor

func (Stat_FileType) Enum

func (x Stat_FileType) Enum() *Stat_FileType

func (Stat_FileType) EnumDescriptor deprecated

func (Stat_FileType) EnumDescriptor() ([]byte, []int)

Deprecated: Use Stat_FileType.Descriptor instead.

func (Stat_FileType) Number

func (Stat_FileType) String

func (x Stat_FileType) String() string

func (Stat_FileType) Type

type Stat_Ident

type Stat_Ident struct {
	Id   uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`    // numeric ID
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // human-readable name
	// contains filtered or unexported fields
}

An Ident represents the identity of a user or group.

func (*Stat_Ident) Descriptor deprecated

func (*Stat_Ident) Descriptor() ([]byte, []int)

Deprecated: Use Stat_Ident.ProtoReflect.Descriptor instead.

func (*Stat_Ident) GetId

func (x *Stat_Ident) GetId() uint64

func (*Stat_Ident) GetName

func (x *Stat_Ident) GetName() string

func (*Stat_Ident) ProtoMessage

func (*Stat_Ident) ProtoMessage()

func (*Stat_Ident) ProtoReflect

func (x *Stat_Ident) ProtoReflect() protoreflect.Message

func (*Stat_Ident) Reset

func (x *Stat_Ident) Reset()

func (*Stat_Ident) String

func (x *Stat_Ident) String() string

type Timestamp

type Timestamp struct {
	Seconds uint64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
	Nanos   uint32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
	// contains filtered or unexported fields
}

Time is the encoding of a timestamp, in seconds and nanoseconds elapsed since the Unix epoch in UTC.

func (*Timestamp) Descriptor deprecated

func (*Timestamp) Descriptor() ([]byte, []int)

Deprecated: Use Timestamp.ProtoReflect.Descriptor instead.

func (*Timestamp) GetNanos

func (x *Timestamp) GetNanos() uint32

func (*Timestamp) GetSeconds

func (x *Timestamp) GetSeconds() uint64

func (*Timestamp) ProtoMessage

func (*Timestamp) ProtoMessage()

func (*Timestamp) ProtoReflect

func (x *Timestamp) ProtoReflect() protoreflect.Message

func (*Timestamp) Reset

func (x *Timestamp) Reset()

func (*Timestamp) String

func (x *Timestamp) String() string

type XAttr

type XAttr struct {
	Name  string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

An XAttr records the name and value of an extended attribute. The contents of the value are not interpreted.

func (*XAttr) Descriptor deprecated

func (*XAttr) Descriptor() ([]byte, []int)

Deprecated: Use XAttr.ProtoReflect.Descriptor instead.

func (*XAttr) GetName

func (x *XAttr) GetName() string

func (*XAttr) GetValue

func (x *XAttr) GetValue() []byte

func (*XAttr) ProtoMessage

func (*XAttr) ProtoMessage()

func (*XAttr) ProtoReflect

func (x *XAttr) ProtoReflect() protoreflect.Message

func (*XAttr) Reset

func (x *XAttr) Reset()

func (*XAttr) String

func (x *XAttr) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL