Documentation

Overview

    Package filemetadata contains types of metadata for files, to be used for caching.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type Cache

    type Cache interface {
    	Get(path string) *Metadata
    	Delete(filename string) error
    	Update(path string, cacheEntry *Metadata) error
    	Reset()
    	GetCacheHits() uint64
    	GetCacheMisses() uint64
    }

      Cache is a cache for file contents->Metadata.

      func NewNoopCache

      func NewNoopCache() Cache

        NewNoopCache returns a cache that doesn't cache (evaluates on every Get).

        func NewSingleFlightCache

        func NewSingleFlightCache() Cache

          NewSingleFlightCache returns a singleton-backed in-memory cache, with no validation.

          type FileError

          type FileError struct {
          	IsNotFound bool
          	Err        error
          }

            FileError is the error returned by the Compute function.

            func (*FileError) Error

            func (e *FileError) Error() string

              Error returns the error message.

              type Metadata

              type Metadata struct {
              	Digest       digest.Digest
              	IsExecutable bool
              	IsDirectory  bool
              	Err          error
              	Symlink      *SymlinkMetadata
              }

                Metadata contains details for a particular file.

                func Compute

                func Compute(filename string) *Metadata

                  Compute computes a Metadata from a given file path. If an error is returned, it will be of type *FileError.

                  type SymlinkMetadata

                  type SymlinkMetadata struct {
                  	Target     string
                  	IsDangling bool
                  }

                    SymlinkMetadata contains details if the given path is a symlink.