metadata

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2017 License: Apache-2.0, BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package metadata is a generated protocol buffer package.

It is generated from these files:

update_metadata.proto

It has these top-level messages:

InstallOperation
Extent
Signatures
InstallInfo
InstallProcedure
DeltaArchiveManifest

Index

Constants

View Source
const Default_DeltaArchiveManifest_BlockSize uint32 = 4096
View Source
const Magic = "CrAU"

Magic is the first four bytes of any update payload.

View Source
const Version = 1

Major version of the payload format.

Variables

View Source
var InstallOperation_Type_name = map[int32]string{
	0: "REPLACE",
	1: "REPLACE_BZ",
	2: "MOVE",
	3: "BSDIFF",
}
View Source
var InstallOperation_Type_value = map[string]int32{
	"REPLACE":    0,
	"REPLACE_BZ": 1,
	"MOVE":       2,
	"BSDIFF":     3,
}
View Source
var InstallProcedure_Type_name = map[int32]string{
	0: "KERNEL",
}
View Source
var InstallProcedure_Type_value = map[string]int32{
	"KERNEL": 0,
}

Functions

This section is empty.

Types

type DeltaArchiveHeader

type DeltaArchiveHeader struct {
	Magic        [4]byte // "CrAU"
	Version      uint64  // 1
	ManifestSize uint64
}

DeltaArchiveHeader begins the payload file.

type DeltaArchiveManifest

type DeltaArchiveManifest struct {
	// The update procedure for the main partition (USR-A or USR-B). Once
	// complete it should match the hash specified in new_partition_info.
	PartitionOperations []*InstallOperation `protobuf:"bytes,1,rep,name=partition_operations" json:"partition_operations,omitempty"`
	// This field is maintained for compatibility with older update_engine
	// clients. In the ChromeOS days it covered the kernel partition but in
	// CoreOS it has only been used to insert a dummy operation to account for
	// the signatures tacked onto the end of the payload. The code was not smart
	// enough to stop passing data to the filesystem writer code after the
	// signatures_offset had been reached, instead using the magic punch-hole
	// value to skip over the extra data. Since CoreOS versions of update_engine
	// only partially removed support kernel partitions passing anything other
	// than dummy operations will trigger broken code paths but omitting the
	// dummy operations will fail when the filesystem writer receives unexpected
	// data. Therefore to work with old versions it strictly *must* look like:
	//
	//   noop_operations: {
	//     type: REPLACE
	//     data_offset: signatures_offset
	//     data_length: signatures_size
	//     dst_extents: {
	//       start_block: UINT64_MAX
	//       num_blocks: (signature_size + block_size - 1) / block_size
	//     }
	//   }
	//
	NoopOperations []*InstallOperation `protobuf:"bytes,2,rep,name=noop_operations" json:"noop_operations,omitempty"`
	// (At time of writing) usually 4096
	BlockSize *uint32 `protobuf:"varint,3,opt,name=block_size,def=4096" json:"block_size,omitempty"`
	// If signatures are present, the offset into the blobs, generally
	// tacked onto the end of the file, and the length. We use an offset
	// rather than a bool to allow for more flexibility in future file formats.
	// If either is absent, it means signatures aren't supported in this
	// file.
	SignaturesOffset *uint64 `protobuf:"varint,4,opt,name=signatures_offset" json:"signatures_offset,omitempty"`
	SignaturesSize   *uint64 `protobuf:"varint,5,opt,name=signatures_size" json:"signatures_size,omitempty"`
	// Partition data that can be used to validate the update.
	OldPartitionInfo *InstallInfo `protobuf:"bytes,8,opt,name=old_partition_info" json:"old_partition_info,omitempty"`
	NewPartitionInfo *InstallInfo `protobuf:"bytes,9,opt,name=new_partition_info" json:"new_partition_info,omitempty"`
	// In addition to the partition update, process updates for additional
	// files, such as kernels. Versions of update_engine that can interpret
	// this list *MUST* ignore noop_operations and properly account for the
	// signature data at the end of the payload.
	Procedures       []*InstallProcedure `protobuf:"bytes,10,rep,name=procedures" json:"procedures,omitempty"`
	XXX_unrecognized []byte              `json:"-"`
}

func (*DeltaArchiveManifest) Descriptor

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

func (*DeltaArchiveManifest) GetBlockSize

func (m *DeltaArchiveManifest) GetBlockSize() uint32

func (*DeltaArchiveManifest) GetNewPartitionInfo

func (m *DeltaArchiveManifest) GetNewPartitionInfo() *InstallInfo

func (*DeltaArchiveManifest) GetNoopOperations

func (m *DeltaArchiveManifest) GetNoopOperations() []*InstallOperation

func (*DeltaArchiveManifest) GetOldPartitionInfo

func (m *DeltaArchiveManifest) GetOldPartitionInfo() *InstallInfo

func (*DeltaArchiveManifest) GetPartitionOperations

func (m *DeltaArchiveManifest) GetPartitionOperations() []*InstallOperation

func (*DeltaArchiveManifest) GetProcedures

func (m *DeltaArchiveManifest) GetProcedures() []*InstallProcedure

func (*DeltaArchiveManifest) GetSignaturesOffset

func (m *DeltaArchiveManifest) GetSignaturesOffset() uint64

func (*DeltaArchiveManifest) GetSignaturesSize

func (m *DeltaArchiveManifest) GetSignaturesSize() uint64

func (*DeltaArchiveManifest) ProtoMessage

func (*DeltaArchiveManifest) ProtoMessage()

func (*DeltaArchiveManifest) Reset

func (m *DeltaArchiveManifest) Reset()

func (*DeltaArchiveManifest) String

func (m *DeltaArchiveManifest) String() string

type Extent

type Extent struct {
	StartBlock       *uint64 `protobuf:"varint,1,opt,name=start_block" json:"start_block,omitempty"`
	NumBlocks        *uint64 `protobuf:"varint,2,opt,name=num_blocks" json:"num_blocks,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

Data is packed into blocks on disk, always starting from the beginning of the block. If a file's data is too large for one block, it overflows into another block, which may or may not be the following block on the physical partition. An ordered list of extents is another representation of an ordered list of blocks. For example, a file stored in blocks 9, 10, 11, 2, 18, 12 (in that order) would be stored in extents { {9, 3}, {2, 1}, {18, 1}, {12, 1} } (in that order). In general, files are stored sequentially on disk, so it's more efficient to use extents to encode the block lists (this is effectively run-length encoding). A sentinel value (UINT64_MAX) as the start block denotes a sparse-hole in a file whose block-length is specified by num_blocks.

func (*Extent) Descriptor

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

func (*Extent) GetNumBlocks

func (m *Extent) GetNumBlocks() uint64

func (*Extent) GetStartBlock

func (m *Extent) GetStartBlock() uint64

func (*Extent) ProtoMessage

func (*Extent) ProtoMessage()

func (*Extent) Reset

func (m *Extent) Reset()

func (*Extent) String

func (m *Extent) String() string

type InstallInfo

type InstallInfo struct {
	Size             *uint64 `protobuf:"varint,1,opt,name=size" json:"size,omitempty"`
	Hash             []byte  `protobuf:"bytes,2,opt,name=hash" json:"hash,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

func (*InstallInfo) Descriptor

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

func (*InstallInfo) GetHash

func (m *InstallInfo) GetHash() []byte

func (*InstallInfo) GetSize

func (m *InstallInfo) GetSize() uint64

func (*InstallInfo) ProtoMessage

func (*InstallInfo) ProtoMessage()

func (*InstallInfo) Reset

func (m *InstallInfo) Reset()

func (*InstallInfo) String

func (m *InstallInfo) String() string

type InstallOperation

type InstallOperation struct {
	Type *InstallOperation_Type `protobuf:"varint,1,req,name=type,enum=chromeos_update_engine.InstallOperation_Type" json:"type,omitempty"`
	// The offset into the delta file (after the protobuf)
	// where the data (if any) is stored
	DataOffset *uint32 `protobuf:"varint,2,opt,name=data_offset" json:"data_offset,omitempty"`
	// The length of the data in the delta file
	DataLength *uint32 `protobuf:"varint,3,opt,name=data_length" json:"data_length,omitempty"`
	// Ordered list of extents that are read from (if any) and written to.
	SrcExtents []*Extent `protobuf:"bytes,4,rep,name=src_extents" json:"src_extents,omitempty"`
	// Byte length of src, not necessarily block aligned. It's only used for
	// BSDIFF, because we need to pass that external program the number
	// of bytes to read from the blocks we pass it.
	SrcLength  *uint64   `protobuf:"varint,5,opt,name=src_length" json:"src_length,omitempty"`
	DstExtents []*Extent `protobuf:"bytes,6,rep,name=dst_extents" json:"dst_extents,omitempty"`
	// byte length of dst, not necessarily block aligned. It's only used for
	// BSDIFF, because we need to fill in the rest of the last block
	// that bsdiff writes with '\0' bytes.
	DstLength *uint64 `protobuf:"varint,7,opt,name=dst_length" json:"dst_length,omitempty"`
	// Optional SHA 256 hash of the blob associated with this operation.
	// This is used as a primary validation for http-based downloads and
	// as a defense-in-depth validation for https-based downloads. If
	// the operation doesn't refer to any blob, this field will have
	// zero bytes.
	DataSha256Hash   []byte `protobuf:"bytes,8,opt,name=data_sha256_hash" json:"data_sha256_hash,omitempty"`
	XXX_unrecognized []byte `json:"-"`
}

The client will perform each InstallOperation in order, beginning even before the entire delta file is downloaded (but after at least the protobuf is downloaded). The types of operations are explained:

  • REPLACE: Replace the dst_extents on the drive with the attached data, zero padding out to block size.
  • REPLACE_BZ: bzip2-uncompress the attached data and write it into dst_extents on the drive, zero padding to block size.
  • MOVE: Copy the data in src_extents to dst_extents. Extents may overlap, so it may be desirable to read all src_extents data into memory before writing it out.
  • BSDIFF: Read src_length bytes from src_extents into memory, perform bspatch with attached data, write new data to dst_extents, zero padding to block size.

func (*InstallOperation) Descriptor

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

func (*InstallOperation) GetDataLength

func (m *InstallOperation) GetDataLength() uint32

func (*InstallOperation) GetDataOffset

func (m *InstallOperation) GetDataOffset() uint32

func (*InstallOperation) GetDataSha256Hash

func (m *InstallOperation) GetDataSha256Hash() []byte

func (*InstallOperation) GetDstExtents

func (m *InstallOperation) GetDstExtents() []*Extent

func (*InstallOperation) GetDstLength

func (m *InstallOperation) GetDstLength() uint64

func (*InstallOperation) GetSrcExtents

func (m *InstallOperation) GetSrcExtents() []*Extent

func (*InstallOperation) GetSrcLength

func (m *InstallOperation) GetSrcLength() uint64

func (*InstallOperation) GetType

func (*InstallOperation) ProtoMessage

func (*InstallOperation) ProtoMessage()

func (*InstallOperation) Reset

func (m *InstallOperation) Reset()

func (*InstallOperation) String

func (m *InstallOperation) String() string

type InstallOperation_Type

type InstallOperation_Type int32
const (
	InstallOperation_REPLACE    InstallOperation_Type = 0
	InstallOperation_REPLACE_BZ InstallOperation_Type = 1
	InstallOperation_MOVE       InstallOperation_Type = 2
	InstallOperation_BSDIFF     InstallOperation_Type = 3
)

func (InstallOperation_Type) Enum

func (InstallOperation_Type) EnumDescriptor

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

func (InstallOperation_Type) String

func (x InstallOperation_Type) String() string

func (*InstallOperation_Type) UnmarshalJSON

func (x *InstallOperation_Type) UnmarshalJSON(data []byte) error

type InstallProcedure

type InstallProcedure struct {
	Type             *InstallProcedure_Type `protobuf:"varint,1,req,name=type,enum=chromeos_update_engine.InstallProcedure_Type" json:"type,omitempty"`
	Operations       []*InstallOperation    `protobuf:"bytes,2,rep,name=operations" json:"operations,omitempty"`
	OldInfo          *InstallInfo           `protobuf:"bytes,3,opt,name=old_info" json:"old_info,omitempty"`
	NewInfo          *InstallInfo           `protobuf:"bytes,4,opt,name=new_info" json:"new_info,omitempty"`
	XXX_unrecognized []byte                 `json:"-"`
}

InstallProcedure defines the update procedure for a single file or block device (except for /usr which is in DeltaArchiveManifest).

func (*InstallProcedure) Descriptor

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

func (*InstallProcedure) GetNewInfo

func (m *InstallProcedure) GetNewInfo() *InstallInfo

func (*InstallProcedure) GetOldInfo

func (m *InstallProcedure) GetOldInfo() *InstallInfo

func (*InstallProcedure) GetOperations

func (m *InstallProcedure) GetOperations() []*InstallOperation

func (*InstallProcedure) GetType

func (*InstallProcedure) ProtoMessage

func (*InstallProcedure) ProtoMessage()

func (*InstallProcedure) Reset

func (m *InstallProcedure) Reset()

func (*InstallProcedure) String

func (m *InstallProcedure) String() string

type InstallProcedure_Type

type InstallProcedure_Type int32
const (
	InstallProcedure_KERNEL InstallProcedure_Type = 0
)

func (InstallProcedure_Type) Enum

func (InstallProcedure_Type) EnumDescriptor

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

func (InstallProcedure_Type) String

func (x InstallProcedure_Type) String() string

func (*InstallProcedure_Type) UnmarshalJSON

func (x *InstallProcedure_Type) UnmarshalJSON(data []byte) error

type Signatures

type Signatures struct {
	Signatures       []*Signatures_Signature `protobuf:"bytes,1,rep,name=signatures" json:"signatures,omitempty"`
	XXX_unrecognized []byte                  `json:"-"`
}

Signatures: Updates may be signed by the OS vendor. The client verifies an update's signature by hashing the entire download. The section of the download that contains the signature is at the end of the file, so when signing a file, only the part up to the signature part is signed. Then, the client looks inside the download's Signatures message for a Signature message that it knows how to handle. Generally, a client will only know how to handle one type of signature, but an update may contain many signatures to support many different types of client. Then client selects a Signature message and uses that, along with a known public key, to verify the download. The public key is expected to be part of the client.

func (*Signatures) Descriptor

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

func (*Signatures) GetSignatures

func (m *Signatures) GetSignatures() []*Signatures_Signature

func (*Signatures) ProtoMessage

func (*Signatures) ProtoMessage()

func (*Signatures) Reset

func (m *Signatures) Reset()

func (*Signatures) String

func (m *Signatures) String() string

type Signatures_Signature

type Signatures_Signature struct {
	Version          *uint32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
	Data             []byte  `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

func (*Signatures_Signature) Descriptor

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

func (*Signatures_Signature) GetData

func (m *Signatures_Signature) GetData() []byte

func (*Signatures_Signature) GetVersion

func (m *Signatures_Signature) GetVersion() uint32

func (*Signatures_Signature) ProtoMessage

func (*Signatures_Signature) ProtoMessage()

func (*Signatures_Signature) Reset

func (m *Signatures_Signature) Reset()

func (*Signatures_Signature) String

func (m *Signatures_Signature) String() string

Jump to

Keyboard shortcuts

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