Documentation ¶
Index ¶
- Constants
- func GCSPathToImageID(bucket, path string) string
- func ImageIDToGCSPath(imageID string) (string, string)
- func LocalDirFromGCSImageID(imageID string) string
- func NewMemDiffStore(client *http.Client, baseDir string, gsBucketNames []string, ...) (diff.DiffStore, error)
- func NewNetDiffStore(conn *grpc.ClientConn, diffServerImageAddress string, codec util.LRUCodec) (diff.DiffStore, error)
- func RegisterDiffServiceServer(s *grpc.Server, srv DiffServiceServer)
- func ValidGCSImageID(imageID string) bool
- type DiffServiceClient
- type DiffServiceImpl
- func (d *DiffServiceImpl) GetDiffs(ctx context.Context, req *GetDiffsRequest) (*GetDiffsResponse, error)
- func (d *DiffServiceImpl) Ping(context.Context, *Empty) (*Empty, error)
- func (d *DiffServiceImpl) PurgeDigests(ctx context.Context, req *PurgeDigestsRequest) (*Empty, error)
- func (d *DiffServiceImpl) UnavailableDigests(ctx context.Context, req *Empty) (*UnavailableDigestsResponse, error)
- func (d *DiffServiceImpl) WarmDiffs(ctx context.Context, req *WarmDiffsRequest) (*Empty, error)
- func (d *DiffServiceImpl) WarmDigests(ctx context.Context, req *WarmDigestsRequest) (*Empty, error)
- type DiffServiceServer
- type DiffStoreMapper
- type DigestFailureResponse
- func (*DigestFailureResponse) Descriptor() ([]byte, []int)
- func (m *DigestFailureResponse) GetDigest() string
- func (m *DigestFailureResponse) GetReason() string
- func (m *DigestFailureResponse) GetTS() int64
- func (*DigestFailureResponse) ProtoMessage()
- func (m *DigestFailureResponse) Reset()
- func (m *DigestFailureResponse) String() string
- func (m *DigestFailureResponse) XXX_DiscardUnknown()
- func (m *DigestFailureResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *DigestFailureResponse) XXX_Merge(src proto.Message)
- func (m *DigestFailureResponse) XXX_Size() int
- func (m *DigestFailureResponse) XXX_Unmarshal(b []byte) error
- type Empty
- func (*Empty) Descriptor() ([]byte, []int)
- func (*Empty) ProtoMessage()
- func (m *Empty) Reset()
- func (m *Empty) String() string
- func (m *Empty) XXX_DiscardUnknown()
- func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Empty) XXX_Merge(src proto.Message)
- func (m *Empty) XXX_Size() int
- func (m *Empty) XXX_Unmarshal(b []byte) error
- type GetDiffsRequest
- func (*GetDiffsRequest) Descriptor() ([]byte, []int)
- func (m *GetDiffsRequest) GetMainDigest() string
- func (m *GetDiffsRequest) GetPriority() int64
- func (m *GetDiffsRequest) GetRightDigests() []string
- func (*GetDiffsRequest) ProtoMessage()
- func (m *GetDiffsRequest) Reset()
- func (m *GetDiffsRequest) String() string
- func (m *GetDiffsRequest) XXX_DiscardUnknown()
- func (m *GetDiffsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GetDiffsRequest) XXX_Merge(src proto.Message)
- func (m *GetDiffsRequest) XXX_Size() int
- func (m *GetDiffsRequest) XXX_Unmarshal(b []byte) error
- type GetDiffsResponse
- func (*GetDiffsResponse) Descriptor() ([]byte, []int)
- func (m *GetDiffsResponse) GetDiffs() []byte
- func (*GetDiffsResponse) ProtoMessage()
- func (m *GetDiffsResponse) Reset()
- func (m *GetDiffsResponse) String() string
- func (m *GetDiffsResponse) XXX_DiscardUnknown()
- func (m *GetDiffsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GetDiffsResponse) XXX_Merge(src proto.Message)
- func (m *GetDiffsResponse) XXX_Size() int
- func (m *GetDiffsResponse) XXX_Unmarshal(b []byte) error
- type GoldDiffStoreMapper
- func (g GoldDiffStoreMapper) DiffFn(leftImg *image.NRGBA, rightImg *image.NRGBA) (interface{}, *image.NRGBA)
- func (g GoldDiffStoreMapper) DiffID(leftImgID, rightImgID string) string
- func (g GoldDiffStoreMapper) DiffPath(leftImgID, rightImgID string) string
- func (g GoldDiffStoreMapper) ImagePaths(imageID string) (string, string, string)
- func (g GoldDiffStoreMapper) IsValidDiffImgID(diffImgID string) bool
- func (g GoldDiffStoreMapper) IsValidImgID(imgID string) bool
- func (g GoldDiffStoreMapper) SplitDiffID(diffID string) (string, string)
- type ImageLoader
- func (il *ImageLoader) Get(priority int64, images []string) ([]*image.NRGBA, *sync.WaitGroup, error)
- func (il *ImageLoader) IsOnDisk(imageID string) bool
- func (il *ImageLoader) PurgeImages(images []string, purgeGCS bool) error
- func (il *ImageLoader) Warm(priority int64, images []string, synchronous bool)
- type MemDiffStore
- func (d *MemDiffStore) ConvertLegacy()
- func (d *MemDiffStore) Get(priority int64, mainDigest string, rightDigests []string) (map[string]interface{}, error)
- func (m *MemDiffStore) ImageHandler(urlPrefix string) (http.Handler, error)
- func (m *MemDiffStore) PurgeDigests(digests []string, purgeGCS bool) error
- func (m *MemDiffStore) UnavailableDigests() map[string]*diff.DigestFailure
- func (d *MemDiffStore) WarmDiffs(priority int64, leftDigests []string, rightDigests []string)
- func (d *MemDiffStore) WarmDigests(priority int64, digests []string, sync bool)
- type MetricMapCodec
- type NetDiffStore
- func (n *NetDiffStore) Get(priority int64, mainDigest string, rightDigests []string) (map[string]interface{}, error)
- func (n *NetDiffStore) ImageHandler(urlPrefix string) (http.Handler, error)
- func (n *NetDiffStore) PurgeDigests(digests []string, purgeGCS bool) error
- func (n *NetDiffStore) UnavailableDigests() map[string]*diff.DigestFailure
- func (n *NetDiffStore) WarmDiffs(priority int64, leftDigests []string, rightDigests []string)
- func (n *NetDiffStore) WarmDigests(priority int64, digests []string, sync bool)
- type PurgeDigestsRequest
- func (*PurgeDigestsRequest) Descriptor() ([]byte, []int)
- func (m *PurgeDigestsRequest) GetDigests() []string
- func (m *PurgeDigestsRequest) GetPurgeGCS() bool
- func (*PurgeDigestsRequest) ProtoMessage()
- func (m *PurgeDigestsRequest) Reset()
- func (m *PurgeDigestsRequest) String() string
- func (m *PurgeDigestsRequest) XXX_DiscardUnknown()
- func (m *PurgeDigestsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PurgeDigestsRequest) XXX_Merge(src proto.Message)
- func (m *PurgeDigestsRequest) XXX_Size() int
- func (m *PurgeDigestsRequest) XXX_Unmarshal(b []byte) error
- type UnavailableDigestsResponse
- func (*UnavailableDigestsResponse) Descriptor() ([]byte, []int)
- func (m *UnavailableDigestsResponse) GetDigestFailures() map[string]*DigestFailureResponse
- func (*UnavailableDigestsResponse) ProtoMessage()
- func (m *UnavailableDigestsResponse) Reset()
- func (m *UnavailableDigestsResponse) String() string
- func (m *UnavailableDigestsResponse) XXX_DiscardUnknown()
- func (m *UnavailableDigestsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UnavailableDigestsResponse) XXX_Merge(src proto.Message)
- func (m *UnavailableDigestsResponse) XXX_Size() int
- func (m *UnavailableDigestsResponse) XXX_Unmarshal(b []byte) error
- type WarmDiffsRequest
- func (*WarmDiffsRequest) Descriptor() ([]byte, []int)
- func (m *WarmDiffsRequest) GetLeftDigests() []string
- func (m *WarmDiffsRequest) GetPriority() int64
- func (m *WarmDiffsRequest) GetRightDigests() []string
- func (*WarmDiffsRequest) ProtoMessage()
- func (m *WarmDiffsRequest) Reset()
- func (m *WarmDiffsRequest) String() string
- func (m *WarmDiffsRequest) XXX_DiscardUnknown()
- func (m *WarmDiffsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *WarmDiffsRequest) XXX_Merge(src proto.Message)
- func (m *WarmDiffsRequest) XXX_Size() int
- func (m *WarmDiffsRequest) XXX_Unmarshal(b []byte) error
- type WarmDigestsRequest
- func (*WarmDigestsRequest) Descriptor() ([]byte, []int)
- func (m *WarmDigestsRequest) GetDigests() []string
- func (m *WarmDigestsRequest) GetPriority() int64
- func (m *WarmDigestsRequest) GetSync() bool
- func (*WarmDigestsRequest) ProtoMessage()
- func (m *WarmDigestsRequest) Reset()
- func (m *WarmDigestsRequest) String() string
- func (m *WarmDigestsRequest) XXX_DiscardUnknown()
- func (m *WarmDigestsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *WarmDigestsRequest) XXX_Merge(src proto.Message)
- func (m *WarmDigestsRequest) XXX_Size() int
- func (m *WarmDigestsRequest) XXX_Unmarshal(b []byte) error
Constants ¶
const ( // IMG_EXTENSION is the default extension of images. IMG_EXTENSION = "png" // GS_PREFIX is the prefix of an imageID that indicates that it is corresponds // to a storage location in GCS. GS_PREFIX = "gs" )
const ( // MAX_URI_GET_TRIES is the number of tries we do to load an image. MAX_URI_GET_TRIES = 4 // Number of concurrent workers downloading images. N_IMG_WORKERS = 10 )
const ( // DEFAULT_IMG_DIR_NAME is the directory where the images are stored. DEFAULT_IMG_DIR_NAME = "images" // DEFAULT_DIFFIMG_DIR_NAME is the directory where the diff images are stored. DEFAULT_DIFFIMG_DIR_NAME = "diffs" // DEFAULT_GCS_IMG_DIR_NAME is the default image directory in GCS. DEFAULT_GCS_IMG_DIR_NAME = "dm-images-v1" // DEFAULT_TEMPFILE_DIR_NAME is the name of the temp directory. DEFAULT_TEMPFILE_DIR_NAME = "__temp" // BYTES_PER_IMAGE is the estimated number of bytes an uncompressed images consumes. // Used to conservatively estimate the maximum number of items in the cache. BYTES_PER_IMAGE = 1024 * 1024 // BYTES_PER_DIFF_METRIC is the estimated number of bytes per diff metric. // Used to conservatively estimate the maximum number of items in the cache. BYTES_PER_DIFF_METRIC = 100 )
const ( // METRICSDB_NAME is the name of the boltdb caching diff metrics. METRICSDB_NAME = "diffstore_metrics" // METRICS_DIGEST_INDEX is the index name to keep track of digests in the metrics db. METRICS_DIGEST_INDEX = "metric_digest_index" )
const ( // DIFF_IMG_SEPARATOR is the character that separates two image ids in the // resulting diff image. DIFF_IMG_SEPARATOR = "-" )
const (
// FAILUREDB_NAME is the name of the boltdb storing diff failures.
FAILUREDB_NAME = "diffstore_failures"
)
const MAX_MESSAGE_SIZE = 100 * 1024 * 1024
Variables ¶
This section is empty.
Functions ¶
func GCSPathToImageID ¶
GCSPathToImageID returns a URL compatible encoding of the given location in GCS. It is the inverse of ImageIDToGCSPath.
func ImageIDToGCSPath ¶
func LocalDirFromGCSImageID ¶
func NewMemDiffStore ¶
func NewMemDiffStore(client *http.Client, baseDir string, gsBucketNames []string, gsImageBaseDir string, gigs int, mapper DiffStoreMapper) (diff.DiffStore, error)
NewMemDiffStore returns a new instance of MemDiffStore. 'gigs' is the approximate number of gigs to use for caching. This is not the exact amount memory that will be used, but a tuning parameter to increase or decrease memory used. If 'gigs' is 0 nothing will be cached in memory. If diffFn is not specified, the diff.DefaultDiffFn will be used. If codec is not specified, a JSON codec for the diff.DiffMetrics struct will be used. If mapper is not specified, GoldIDPathMapper will be used.
func NewNetDiffStore ¶
func NewNetDiffStore(conn *grpc.ClientConn, diffServerImageAddress string, codec util.LRUCodec) (diff.DiffStore, error)
NewNetDiffStore implements the diff.DiffStore interface via the gRPC-based DiffService.
func RegisterDiffServiceServer ¶
func RegisterDiffServiceServer(s *grpc.Server, srv DiffServiceServer)
Types ¶
type DiffServiceClient ¶
type DiffServiceClient interface { // Same functionality as Get in the diff.DiffStore interface. GetDiffs(ctx context.Context, in *GetDiffsRequest, opts ...grpc.CallOption) (*GetDiffsResponse, error) // Same functionality as WarmDigests in the diff.DiffStore interface. WarmDigests(ctx context.Context, in *WarmDigestsRequest, opts ...grpc.CallOption) (*Empty, error) // Same functionality as WarmDiffs in the diff.DiffStore interface. WarmDiffs(ctx context.Context, in *WarmDiffsRequest, opts ...grpc.CallOption) (*Empty, error) UnavailableDigests(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*UnavailableDigestsResponse, error) //Same functionality asSee PurgeDigestset in the diff.DiffStore interface. PurgeDigests(ctx context.Context, in *PurgeDigestsRequest, opts ...grpc.CallOption) (*Empty, error) // Ping is used to test connection. Ping(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) }
DiffServiceClient is the client API for DiffService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewDiffServiceClient ¶
func NewDiffServiceClient(cc *grpc.ClientConn) DiffServiceClient
type DiffServiceImpl ¶
type DiffServiceImpl struct {
// contains filtered or unexported fields
}
DiffServiceImpl implements DiffServiceServer.
func (*DiffServiceImpl) GetDiffs ¶
func (d *DiffServiceImpl) GetDiffs(ctx context.Context, req *GetDiffsRequest) (*GetDiffsResponse, error)
GetDiffs wraps around the Get method of the underlying DiffStore.
func (*DiffServiceImpl) PurgeDigests ¶
func (d *DiffServiceImpl) PurgeDigests(ctx context.Context, req *PurgeDigestsRequest) (*Empty, error)
PurgeDigests wraps around the PurgeDigests method of the underlying DiffStore.
func (*DiffServiceImpl) UnavailableDigests ¶
func (d *DiffServiceImpl) UnavailableDigests(ctx context.Context, req *Empty) (*UnavailableDigestsResponse, error)
UnavailableDigests wraps around the UnavailableDigests method of the underlying DiffStore.
func (*DiffServiceImpl) WarmDiffs ¶
func (d *DiffServiceImpl) WarmDiffs(ctx context.Context, req *WarmDiffsRequest) (*Empty, error)
WarmDiffs wraps around the WarmDiffs method of the underlying DiffStore.
func (*DiffServiceImpl) WarmDigests ¶
func (d *DiffServiceImpl) WarmDigests(ctx context.Context, req *WarmDigestsRequest) (*Empty, error)
WarmDigests wraps around the WarmDigests method of the underlying DiffStore.
type DiffServiceServer ¶
type DiffServiceServer interface { // Same functionality as Get in the diff.DiffStore interface. GetDiffs(context.Context, *GetDiffsRequest) (*GetDiffsResponse, error) // Same functionality as WarmDigests in the diff.DiffStore interface. WarmDigests(context.Context, *WarmDigestsRequest) (*Empty, error) // Same functionality as WarmDiffs in the diff.DiffStore interface. WarmDiffs(context.Context, *WarmDiffsRequest) (*Empty, error) UnavailableDigests(context.Context, *Empty) (*UnavailableDigestsResponse, error) //Same functionality asSee PurgeDigestset in the diff.DiffStore interface. PurgeDigests(context.Context, *PurgeDigestsRequest) (*Empty, error) // Ping is used to test connection. Ping(context.Context, *Empty) (*Empty, error) }
DiffServiceServer is the server API for DiffService service.
func NewDiffServiceServer ¶
func NewDiffServiceServer(diffStore diff.DiffStore, codec util.LRUCodec) DiffServiceServer
NewDiffServiceServer implements the server side of the diff service by wrapping around a DiffStore, most likely an instance of MemDiffStore.
type DiffStoreMapper ¶
type DiffStoreMapper interface { // LRUCodec defines the Encode and Decode functions to serialize/deserialize // instances of the diff metrics returned by the DiffFn function below. util.LRUCodec // DiffFn calculates the different between two given images and returns a // difference image. The type underlying interface{} is the input and output // of the LRUCodec above. It is also what is returned by the Get(...) function // of the DiffStore interface. DiffFn(*image.NRGBA, *image.NRGBA) (interface{}, *image.NRGBA) // Takes two image IDs and returns a unique diff ID. // Note: DiffID(a,b) == DiffID(b, a) should hold. DiffID(leftImgID, rightImgID string) string // Inverse function of DiffID. // SplitDiffID(DiffID(a,b)) should return (a,b) or (b,a). SplitDiffID(diffID string) (string, string) // DiffPath returns the local file path for the diff image of two images. // This path is used to store the diff image on disk and serve it over HTTP. DiffPath(leftImgID, rightImgID string) string // ImagePaths returns the storage paths for a given image ID. The first return // value is the local file path used to store the image on disk and serve it // over HTTP. The second return value is the storage bucket and the third the // path within that bucket. ImagePaths(imageID string) (string, string, string) // IsValidDiffImgID returns true if the given diffImgID is in the correct format. IsValidDiffImgID(diffImgID string) bool // IsValidImgID returns true if the given imgID is in the correct format. IsValidImgID(imgID string) bool }
DiffStoreMapper is the interface to customize the specific behavior of MemDiffStore. It defines what diff metric is calculated and how to translate image ids and diff ids into paths on the file system and in GCS.
func NewGoldDiffStoreMapper ¶
func NewGoldDiffStoreMapper(diffInstance interface{}) DiffStoreMapper
NewGoldDiffStoreMapper returns a new instance of GoldDiffStoreMapper that uses a JSON coded to serialize/deserialize instances of diff.DiffMetrics.
type DigestFailureResponse ¶
type DigestFailureResponse struct { Digest string `protobuf:"bytes,1,opt,name=Digest,proto3" json:"Digest,omitempty"` Reason string `protobuf:"bytes,2,opt,name=Reason,proto3" json:"Reason,omitempty"` TS int64 `protobuf:"varint,3,opt,name=TS,proto3" json:"TS,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*DigestFailureResponse) Descriptor ¶
func (*DigestFailureResponse) Descriptor() ([]byte, []int)
func (*DigestFailureResponse) GetDigest ¶
func (m *DigestFailureResponse) GetDigest() string
func (*DigestFailureResponse) GetReason ¶
func (m *DigestFailureResponse) GetReason() string
func (*DigestFailureResponse) GetTS ¶
func (m *DigestFailureResponse) GetTS() int64
func (*DigestFailureResponse) ProtoMessage ¶
func (*DigestFailureResponse) ProtoMessage()
func (*DigestFailureResponse) Reset ¶
func (m *DigestFailureResponse) Reset()
func (*DigestFailureResponse) String ¶
func (m *DigestFailureResponse) String() string
func (*DigestFailureResponse) XXX_DiscardUnknown ¶
func (m *DigestFailureResponse) XXX_DiscardUnknown()
func (*DigestFailureResponse) XXX_Marshal ¶
func (m *DigestFailureResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*DigestFailureResponse) XXX_Merge ¶
func (m *DigestFailureResponse) XXX_Merge(src proto.Message)
func (*DigestFailureResponse) XXX_Size ¶
func (m *DigestFailureResponse) XXX_Size() int
func (*DigestFailureResponse) XXX_Unmarshal ¶
func (m *DigestFailureResponse) XXX_Unmarshal(b []byte) error
type Empty ¶
type Empty struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Empty) Descriptor ¶
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) XXX_DiscardUnknown ¶
func (m *Empty) XXX_DiscardUnknown()
func (*Empty) XXX_Marshal ¶
func (*Empty) XXX_Unmarshal ¶
type GetDiffsRequest ¶
type GetDiffsRequest struct { Priority int64 `protobuf:"varint,1,opt,name=priority,proto3" json:"priority,omitempty"` MainDigest string `protobuf:"bytes,2,opt,name=mainDigest,proto3" json:"mainDigest,omitempty"` RightDigests []string `protobuf:"bytes,3,rep,name=rightDigests,proto3" json:"rightDigests,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*GetDiffsRequest) Descriptor ¶
func (*GetDiffsRequest) Descriptor() ([]byte, []int)
func (*GetDiffsRequest) GetMainDigest ¶
func (m *GetDiffsRequest) GetMainDigest() string
func (*GetDiffsRequest) GetPriority ¶
func (m *GetDiffsRequest) GetPriority() int64
func (*GetDiffsRequest) GetRightDigests ¶
func (m *GetDiffsRequest) GetRightDigests() []string
func (*GetDiffsRequest) ProtoMessage ¶
func (*GetDiffsRequest) ProtoMessage()
func (*GetDiffsRequest) Reset ¶
func (m *GetDiffsRequest) Reset()
func (*GetDiffsRequest) String ¶
func (m *GetDiffsRequest) String() string
func (*GetDiffsRequest) XXX_DiscardUnknown ¶
func (m *GetDiffsRequest) XXX_DiscardUnknown()
func (*GetDiffsRequest) XXX_Marshal ¶
func (m *GetDiffsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GetDiffsRequest) XXX_Merge ¶
func (m *GetDiffsRequest) XXX_Merge(src proto.Message)
func (*GetDiffsRequest) XXX_Size ¶
func (m *GetDiffsRequest) XXX_Size() int
func (*GetDiffsRequest) XXX_Unmarshal ¶
func (m *GetDiffsRequest) XXX_Unmarshal(b []byte) error
type GetDiffsResponse ¶
type GetDiffsResponse struct { Diffs []byte `protobuf:"bytes,1,opt,name=diffs,proto3" json:"diffs,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*GetDiffsResponse) Descriptor ¶
func (*GetDiffsResponse) Descriptor() ([]byte, []int)
func (*GetDiffsResponse) GetDiffs ¶
func (m *GetDiffsResponse) GetDiffs() []byte
func (*GetDiffsResponse) ProtoMessage ¶
func (*GetDiffsResponse) ProtoMessage()
func (*GetDiffsResponse) Reset ¶
func (m *GetDiffsResponse) Reset()
func (*GetDiffsResponse) String ¶
func (m *GetDiffsResponse) String() string
func (*GetDiffsResponse) XXX_DiscardUnknown ¶
func (m *GetDiffsResponse) XXX_DiscardUnknown()
func (*GetDiffsResponse) XXX_Marshal ¶
func (m *GetDiffsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GetDiffsResponse) XXX_Merge ¶
func (m *GetDiffsResponse) XXX_Merge(src proto.Message)
func (*GetDiffsResponse) XXX_Size ¶
func (m *GetDiffsResponse) XXX_Size() int
func (*GetDiffsResponse) XXX_Unmarshal ¶
func (m *GetDiffsResponse) XXX_Unmarshal(b []byte) error
type GoldDiffStoreMapper ¶
GoldIDPathMapper implements the DiffStoreMapper interface. It translates between digests (image ids) and storage paths. It uses diff.DiffMetrics as the Gold diff metric.
func (GoldDiffStoreMapper) DiffFn ¶
func (g GoldDiffStoreMapper) DiffFn(leftImg *image.NRGBA, rightImg *image.NRGBA) (interface{}, *image.NRGBA)
DiffFn implements the DiffStoreMapper interface.
func (GoldDiffStoreMapper) DiffID ¶
func (g GoldDiffStoreMapper) DiffID(leftImgID, rightImgID string) string
DiffID implements the DiffStoreMapper interface.
func (GoldDiffStoreMapper) DiffPath ¶
func (g GoldDiffStoreMapper) DiffPath(leftImgID, rightImgID string) string
SplitDiffID implements the DiffStoreMapper interface.
func (GoldDiffStoreMapper) ImagePaths ¶
func (g GoldDiffStoreMapper) ImagePaths(imageID string) (string, string, string)
ImagePaths implements the DiffStoreMapper interface.
func (GoldDiffStoreMapper) IsValidDiffImgID ¶
func (g GoldDiffStoreMapper) IsValidDiffImgID(diffImgID string) bool
IsValidDiffImgIDimplements the DiffStoreMapper interface.
func (GoldDiffStoreMapper) IsValidImgID ¶
func (g GoldDiffStoreMapper) IsValidImgID(imgID string) bool
IsValidImgIDimplements the DiffStoreMapper interface.
func (GoldDiffStoreMapper) SplitDiffID ¶
func (g GoldDiffStoreMapper) SplitDiffID(diffID string) (string, string)
SplitDiffID implements the DiffStoreMapper interface.
type ImageLoader ¶
type ImageLoader struct {
// contains filtered or unexported fields
}
ImageLoader facilitates to continuously download images and cache them in RAM.
func NewImgLoader ¶
func NewImgLoader(client *http.Client, baseDir, imgDir string, gsBucketNames []string, gsImageBaseDir string, maxCacheSize int, mapper DiffStoreMapper) (*ImageLoader, error)
Creates a new instance of ImageLoader.
func (*ImageLoader) Get ¶
func (il *ImageLoader) Get(priority int64, images []string) ([]*image.NRGBA, *sync.WaitGroup, error)
Get returns the images identified by digests and returns them as NRGBA images. Priority determines the order in which multiple concurrent calls are processed. The returned instance of WaitGroup can be used to wait until all images are not just loaded but also written to disk. Calling the Wait() function of the WaitGroup is optional and the client should not call any of its other functions.
func (*ImageLoader) IsOnDisk ¶
func (il *ImageLoader) IsOnDisk(imageID string) bool
IsOnDisk returns true if the image that corresponds to the given imageID is in the disk cache.
func (*ImageLoader) PurgeImages ¶
func (il *ImageLoader) PurgeImages(images []string, purgeGCS bool) error
PurgeImages removes the images that correspond to the given images.
func (*ImageLoader) Warm ¶
func (il *ImageLoader) Warm(priority int64, images []string, synchronous bool)
Warm makes sure the images are cached. If synchronous is true the call blocks until all fetched images are written to disk. It works in sync with Get, any image that is scheduled to be retrieved by Get will not be fetched again.
type MemDiffStore ¶
type MemDiffStore struct {
// contains filtered or unexported fields
}
MemDiffStore implements the diff.DiffStore interface.
func (*MemDiffStore) ConvertLegacy ¶
func (d *MemDiffStore) ConvertLegacy()
ConvertLegacy converts the legacy metrics cache to the new format in the background.
func (*MemDiffStore) Get ¶
func (d *MemDiffStore) Get(priority int64, mainDigest string, rightDigests []string) (map[string]interface{}, error)
See DiffStore interface.
func (*MemDiffStore) ImageHandler ¶
func (m *MemDiffStore) ImageHandler(urlPrefix string) (http.Handler, error)
ImageHandler implements the DiffStore interface.
func (*MemDiffStore) PurgeDigests ¶
func (m *MemDiffStore) PurgeDigests(digests []string, purgeGCS bool) error
PurgeDigests implements the DiffStore interface.
func (*MemDiffStore) UnavailableDigests ¶
func (m *MemDiffStore) UnavailableDigests() map[string]*diff.DigestFailure
UnavailableDigests implements the DiffStore interface.
func (*MemDiffStore) WarmDiffs ¶
func (d *MemDiffStore) WarmDiffs(priority int64, leftDigests []string, rightDigests []string)
WarmDiffs puts the diff metrics for the cross product of leftDigests x rightDigests into the cache for the given diff metric and with the given priority. This means if there are multiple subsets of the digests with varying priority (ignored vs "regular") we can call this multiple times.
func (*MemDiffStore) WarmDigests ¶
func (d *MemDiffStore) WarmDigests(priority int64, digests []string, sync bool)
WarmDigests fetches images based on the given list of digests. It does not cache the images but makes sure they are downloaded from GCS.
type MetricMapCodec ¶
type MetricMapCodec struct{}
MetricMapCodec implements the util.LRUCodec interface by serializing and deserializing generic diff result structs, instances of map[string]interface{}
func (MetricMapCodec) Decode ¶
func (m MetricMapCodec) Decode(byteData []byte) (interface{}, error)
See util.LRUCodec interface
func (MetricMapCodec) Encode ¶
func (m MetricMapCodec) Encode(data interface{}) ([]byte, error)
See util.LRUCodec interface
type NetDiffStore ¶
type NetDiffStore struct {
// contains filtered or unexported fields
}
NetDiffStore implements the DiffStore interface and wraps around a DiffService client.
func (*NetDiffStore) Get ¶
func (n *NetDiffStore) Get(priority int64, mainDigest string, rightDigests []string) (map[string]interface{}, error)
Get, see the diff.DiffStore interface.
func (*NetDiffStore) ImageHandler ¶
func (n *NetDiffStore) ImageHandler(urlPrefix string) (http.Handler, error)
ImageHandler, see the diff.DiffStore interface. This is not implemented and will always return an error. The images are expected to be served by the the server that implements the backend of the DiffService.
func (*NetDiffStore) PurgeDigests ¶
func (n *NetDiffStore) PurgeDigests(digests []string, purgeGCS bool) error
PurgeDigests, see the diff.DiffStore interface.
func (*NetDiffStore) UnavailableDigests ¶
func (n *NetDiffStore) UnavailableDigests() map[string]*diff.DigestFailure
UnavailableDigests, see the diff.DiffStore interface.
func (*NetDiffStore) WarmDiffs ¶
func (n *NetDiffStore) WarmDiffs(priority int64, leftDigests []string, rightDigests []string)
WarmDiffs, see the diff.DiffStore interface.
func (*NetDiffStore) WarmDigests ¶
func (n *NetDiffStore) WarmDigests(priority int64, digests []string, sync bool)
WarmDigests, see the diff.DiffStore interface.
type PurgeDigestsRequest ¶
type PurgeDigestsRequest struct { Digests []string `protobuf:"bytes,1,rep,name=digests,proto3" json:"digests,omitempty"` PurgeGCS bool `protobuf:"varint,2,opt,name=purgeGCS,proto3" json:"purgeGCS,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*PurgeDigestsRequest) Descriptor ¶
func (*PurgeDigestsRequest) Descriptor() ([]byte, []int)
func (*PurgeDigestsRequest) GetDigests ¶
func (m *PurgeDigestsRequest) GetDigests() []string
func (*PurgeDigestsRequest) GetPurgeGCS ¶
func (m *PurgeDigestsRequest) GetPurgeGCS() bool
func (*PurgeDigestsRequest) ProtoMessage ¶
func (*PurgeDigestsRequest) ProtoMessage()
func (*PurgeDigestsRequest) Reset ¶
func (m *PurgeDigestsRequest) Reset()
func (*PurgeDigestsRequest) String ¶
func (m *PurgeDigestsRequest) String() string
func (*PurgeDigestsRequest) XXX_DiscardUnknown ¶
func (m *PurgeDigestsRequest) XXX_DiscardUnknown()
func (*PurgeDigestsRequest) XXX_Marshal ¶
func (m *PurgeDigestsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PurgeDigestsRequest) XXX_Merge ¶
func (m *PurgeDigestsRequest) XXX_Merge(src proto.Message)
func (*PurgeDigestsRequest) XXX_Size ¶
func (m *PurgeDigestsRequest) XXX_Size() int
func (*PurgeDigestsRequest) XXX_Unmarshal ¶
func (m *PurgeDigestsRequest) XXX_Unmarshal(b []byte) error
type UnavailableDigestsResponse ¶
type UnavailableDigestsResponse struct {}
func (*UnavailableDigestsResponse) Descriptor ¶
func (*UnavailableDigestsResponse) Descriptor() ([]byte, []int)
func (*UnavailableDigestsResponse) GetDigestFailures ¶
func (m *UnavailableDigestsResponse) GetDigestFailures() map[string]*DigestFailureResponse
func (*UnavailableDigestsResponse) ProtoMessage ¶
func (*UnavailableDigestsResponse) ProtoMessage()
func (*UnavailableDigestsResponse) Reset ¶
func (m *UnavailableDigestsResponse) Reset()
func (*UnavailableDigestsResponse) String ¶
func (m *UnavailableDigestsResponse) String() string
func (*UnavailableDigestsResponse) XXX_DiscardUnknown ¶
func (m *UnavailableDigestsResponse) XXX_DiscardUnknown()
func (*UnavailableDigestsResponse) XXX_Marshal ¶
func (m *UnavailableDigestsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*UnavailableDigestsResponse) XXX_Merge ¶
func (m *UnavailableDigestsResponse) XXX_Merge(src proto.Message)
func (*UnavailableDigestsResponse) XXX_Size ¶
func (m *UnavailableDigestsResponse) XXX_Size() int
func (*UnavailableDigestsResponse) XXX_Unmarshal ¶
func (m *UnavailableDigestsResponse) XXX_Unmarshal(b []byte) error
type WarmDiffsRequest ¶
type WarmDiffsRequest struct { Priority int64 `protobuf:"varint,1,opt,name=priority,proto3" json:"priority,omitempty"` LeftDigests []string `protobuf:"bytes,2,rep,name=leftDigests,proto3" json:"leftDigests,omitempty"` RightDigests []string `protobuf:"bytes,3,rep,name=rightDigests,proto3" json:"rightDigests,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*WarmDiffsRequest) Descriptor ¶
func (*WarmDiffsRequest) Descriptor() ([]byte, []int)
func (*WarmDiffsRequest) GetLeftDigests ¶
func (m *WarmDiffsRequest) GetLeftDigests() []string
func (*WarmDiffsRequest) GetPriority ¶
func (m *WarmDiffsRequest) GetPriority() int64
func (*WarmDiffsRequest) GetRightDigests ¶
func (m *WarmDiffsRequest) GetRightDigests() []string
func (*WarmDiffsRequest) ProtoMessage ¶
func (*WarmDiffsRequest) ProtoMessage()
func (*WarmDiffsRequest) Reset ¶
func (m *WarmDiffsRequest) Reset()
func (*WarmDiffsRequest) String ¶
func (m *WarmDiffsRequest) String() string
func (*WarmDiffsRequest) XXX_DiscardUnknown ¶
func (m *WarmDiffsRequest) XXX_DiscardUnknown()
func (*WarmDiffsRequest) XXX_Marshal ¶
func (m *WarmDiffsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*WarmDiffsRequest) XXX_Merge ¶
func (m *WarmDiffsRequest) XXX_Merge(src proto.Message)
func (*WarmDiffsRequest) XXX_Size ¶
func (m *WarmDiffsRequest) XXX_Size() int
func (*WarmDiffsRequest) XXX_Unmarshal ¶
func (m *WarmDiffsRequest) XXX_Unmarshal(b []byte) error
type WarmDigestsRequest ¶
type WarmDigestsRequest struct { Priority int64 `protobuf:"varint,1,opt,name=priority,proto3" json:"priority,omitempty"` Digests []string `protobuf:"bytes,2,rep,name=digests,proto3" json:"digests,omitempty"` Sync bool `protobuf:"varint,3,opt,name=sync,proto3" json:"sync,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*WarmDigestsRequest) Descriptor ¶
func (*WarmDigestsRequest) Descriptor() ([]byte, []int)
func (*WarmDigestsRequest) GetDigests ¶
func (m *WarmDigestsRequest) GetDigests() []string
func (*WarmDigestsRequest) GetPriority ¶
func (m *WarmDigestsRequest) GetPriority() int64
func (*WarmDigestsRequest) GetSync ¶
func (m *WarmDigestsRequest) GetSync() bool
func (*WarmDigestsRequest) ProtoMessage ¶
func (*WarmDigestsRequest) ProtoMessage()
func (*WarmDigestsRequest) Reset ¶
func (m *WarmDigestsRequest) Reset()
func (*WarmDigestsRequest) String ¶
func (m *WarmDigestsRequest) String() string
func (*WarmDigestsRequest) XXX_DiscardUnknown ¶
func (m *WarmDigestsRequest) XXX_DiscardUnknown()
func (*WarmDigestsRequest) XXX_Marshal ¶
func (m *WarmDigestsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*WarmDigestsRequest) XXX_Merge ¶
func (m *WarmDigestsRequest) XXX_Merge(src proto.Message)
func (*WarmDigestsRequest) XXX_Size ¶
func (m *WarmDigestsRequest) XXX_Size() int
func (*WarmDigestsRequest) XXX_Unmarshal ¶
func (m *WarmDigestsRequest) XXX_Unmarshal(b []byte) error