types

package
v0.0.0-...-f44e450 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Index

Constants

View Source
const (
	// CachingPolicyDefault means that the receiving side may chose the policy.
	CachingPolicyDefault = CachingPolicy(iota)

	// CachingPolicyDisable disables cache.
	CachingPolicyDisable

	// CachingPolicyUse enforces only to re-use existing cache, but to do not update it.
	CachingPolicyUse

	// CachingPolicyStore enforces only to update cache, but do not use it.
	CachingPolicyStore

	// CachingPolicyUseAndStore enables cache.
	CachingPolicyUseAndStore
)
View Source
const (

	// HashAlgSHA2_512 requests to use SHA2-512 function
	HashAlgSHA2_512

	// HashAlgBlake3_512 requests to use Blake3-512 function
	HashAlgBlake3_512
)

noinspection GoSnakeCaseUsage

Variables

This section is empty.

Functions

This section is empty.

Types

type BootFlow

type BootFlow types.Flow

BootFlow is a wrapper for types.Flow to make it serializable/deserializable using xjson.

func (BootFlow) MarshalJSON

func (flow BootFlow) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*BootFlow) UnmarshalJSON

func (flow *BootFlow) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type CachingPolicy

type CachingPolicy int

CachingPolicy defines if a cache should be used

TODO: move this value into the context

func CachingPolicyFromThrift

func CachingPolicyFromThrift(in caching_policy.CachingPolicy) CachingPolicy

CachingPolicyFromThrift convert Thrifty CachingPolicy to the internal one.

func (CachingPolicy) ShouldStore

func (policy CachingPolicy) ShouldStore() bool

ShouldStore returns if a cache should be updated.

func (CachingPolicy) ShouldUse

func (policy CachingPolicy) ShouldUse() bool

ShouldUse returns if a cache should be used.

func (CachingPolicy) String

func (policy CachingPolicy) String() string

String implements fmt.Stringer.

type HashValue

type HashValue []byte

HashValue represents a hashed value in the binary form.

func Hash

func Hash(id hashID, data []byte) HashValue

Hash returns a hash-value for the passed data and using specified hash-function.

func NewImageStableHash

func NewImageStableHash(
	firmwareImage *uefi.UEFI,
) (HashValue, error)

NewImageStableHash constructs an ImageStableHash for an image.

func NewImageStableHashFromImage

func NewImageStableHashFromImage(
	firmwareImage []byte,
) (HashValue, error)

NewImageStableHashFromImage constructs an ImageStableHash for an image.

TODO: Parallelize calculation.

func (*HashValue) Scan

func (h *HashValue) Scan(value any) error

Scan implements the Scanner interface for sql.

func (HashValue) String

func (h HashValue) String() string

String implements fmt.Stringer.

func (HashValue) Value

func (h HashValue) Value() (driver.Value, error)

Value implements the driver sql.Valuer interface.

type ImageID

type ImageID [sha512.Size + blake3Size]byte

ImageID is an unique content-based ID of an image. See also: https://en.wikipedia.org/wiki/Content-addressable_storage

If you change this type, then you can modify and use fbcode/scripts/xaionaro/migrate_fas_0/main.go to perform the migration.

func NewImageIDFromBytes

func NewImageIDFromBytes(imageID []byte) ImageID

NewImageIDFromBytes just converts type []byte to ImageID.

func NewImageIDFromImage

func NewImageIDFromImage(image []byte) ImageID

NewImageIDFromImage calculates an ImageID based on image content.

func (ImageID) BlobStorageKey

func (imgID ImageID) BlobStorageKey() []byte

BlobStorageKey returns the path should be used to store this image.

func (ImageID) GoString

func (imgID ImageID) GoString() string

GoString implements fmt.GoStringer.

func (ImageID) IsZero

func (imgID ImageID) IsZero() bool

IsZero returns true if ImageID contains the zero value.

func (ImageID) MarshalJSON

func (imgID ImageID) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*ImageID) Scan

func (imgID *ImageID) Scan(srcI any) error

Scan converts DB's value to ImageID.

func (*ImageID) Set

func (imgID *ImageID) Set(in string) error

Set implements flag.Value.

func (ImageID) String

func (imgID ImageID) String() string

String implements fmt.Stringer.

func (*ImageID) UnmarshalJSON

func (imgID *ImageID) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (ImageID) Value

func (imgID ImageID) Value() (driver.Value, error)

Value converts the value to be stored in DB.

type JobID

type JobID uuid.UUID

JobID is an unique identifier of a job submitted to the server.

func NewJobID

func NewJobID() JobID

NewJobID generates a new random JobID.

func NewJobIDFromBytes

func NewJobIDFromBytes(b []byte) (JobID, error)

NewJobIDFromBytes contructs a JobID given its binary representation.

func ParseJobID

func ParseJobID(s string) (JobID, error)

ParseJobID parses an UUID string as JobID.

func (*JobID) Scan

func (jobID *JobID) Scan(srcI any) error

Scan converts DB's value to JobID.

func (JobID) String

func (jobID JobID) String() string

String implements fmt.Stringer

func (JobID) Value

func (jobID JobID) Value() (driver.Value, error)

Value converts the value to be stored in DB.

Jump to

Keyboard shortcuts

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