contenthash

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 39 Imported by: 36

Documentation

Index

Constants

View Source
const (
	CacheRecordTypeFile      = CacheRecordType_FILE
	CacheRecordTypeDir       = CacheRecordType_DIR
	CacheRecordTypeDirHeader = CacheRecordType_DIR_HEADER
	CacheRecordTypeSymlink   = CacheRecordType_SYMLINK
)

Variables

View Source
var (
	CacheRecordType_name = map[int32]string{
		0: "FILE",
		1: "DIR",
		2: "DIR_HEADER",
		3: "SYMLINK",
	}
	CacheRecordType_value = map[string]int32{
		"FILE":       0,
		"DIR":        1,
		"DIR_HEADER": 2,
		"SYMLINK":    3,
	}
)

Enum value maps for CacheRecordType.

View Source
var File_github_com_moby_buildkit_cache_contenthash_checksum_proto protoreflect.FileDescriptor

Functions

func Checksum

func Checksum(ctx context.Context, ref cache.ImmutableRef, path string, opts ChecksumOpts, s session.Group) (digest.Digest, error)

func ClearCacheContext added in v0.6.0

func ClearCacheContext(md cache.RefMetadata)

func NewFileHash

func NewFileHash(path string, fi os.FileInfo) (hash.Hash, error)

NewFileHash returns new hash that is used for the builder cache keys

func NewFromStat

func NewFromStat(stat *fstypes.Stat) (hash.Hash, error)

func SetCacheContext

func SetCacheContext(ctx context.Context, md cache.RefMetadata, cc CacheContext) error

func WriteV1TarsumHeaders

func WriteV1TarsumHeaders(h *tar.Header, w io.Writer)

WriteV1TarsumHeaders writes a tar header to a writer in V1 tarsum format.

Types

type CacheContext

type CacheContext interface {
	Checksum(ctx context.Context, ref cache.Mountable, p string, opts ChecksumOpts, s session.Group) (digest.Digest, error)
	HandleChange(kind fsutil.ChangeKind, p string, fi os.FileInfo, err error) error
}

func GetCacheContext

func GetCacheContext(ctx context.Context, md cache.RefMetadata) (CacheContext, error)

type CacheRecord

type CacheRecord struct {
	Digest   string          `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"`
	Type     CacheRecordType `protobuf:"varint,2,opt,name=type,proto3,enum=contenthash.CacheRecordType" json:"type,omitempty"`
	Linkname string          `protobuf:"bytes,3,opt,name=linkname,proto3" json:"linkname,omitempty"`
	// contains filtered or unexported fields
}

func (*CacheRecord) CloneMessageVT added in v0.17.0

func (m *CacheRecord) CloneMessageVT() proto.Message

func (*CacheRecord) CloneVT added in v0.17.0

func (m *CacheRecord) CloneVT() *CacheRecord

func (*CacheRecord) Descriptor deprecated

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

Deprecated: Use CacheRecord.ProtoReflect.Descriptor instead.

func (*CacheRecord) EqualMessageVT added in v0.17.0

func (this *CacheRecord) EqualMessageVT(thatMsg proto.Message) bool

func (*CacheRecord) EqualVT added in v0.17.0

func (this *CacheRecord) EqualVT(that *CacheRecord) bool

func (*CacheRecord) GetDigest added in v0.17.0

func (x *CacheRecord) GetDigest() string

func (*CacheRecord) GetLinkname

func (x *CacheRecord) GetLinkname() string

func (*CacheRecord) GetType

func (x *CacheRecord) GetType() CacheRecordType

func (*CacheRecord) MarshalToSizedBufferVT added in v0.17.0

func (m *CacheRecord) MarshalToSizedBufferVT(dAtA []byte) (int, error)