pkg/blobinfocache/boltdb/boltdb.go
func (bdc *cache) RecordKnownLocation(transport types.ImageTransport, scope types.BICTransportScope, blobDigest digest.Digest, location types.BICLocationReference) {
	_ = bdc.update(func(tx *bolt.Tx) error {
		b, err := tx.CreateBucketIfNotExists(knownLocationsBucket)
		if err != nil {
			return err
		}
		b, err = b.CreateBucketIfNotExists([]byte(transport.Name()))
		if err != nil {
			return err
		}
		b, err = b.CreateBucketIfNotExists([]byte(scope.Opaque))
		if err != nil {
			return err
		}
		b, err = b.CreateBucketIfNotExists([]byte(blobDigest.String()))
		if err != nil {
			return err
		}
		value, err := time.Now().MarshalBinary()
		if err != nil {
			return err
		}
		if err := b.Put([]byte(location.Opaque), value); err != nil { // Possibly overwriting an older entry.
			return err
		}
		return nil
	}) // FIXME? Log error (but throttle the log volume on repeated accesses)?
}
func (bdc *cache) RecordKnownLocation(transport types.ImageTransport, scope types.BICTransportScope, blobDigest digest.Digest, location types.BICLocationReference) {
	_ = bdc.update(func(tx *bolt.Tx) error {
		b, err := tx.CreateBucketIfNotExists(knownLocationsBucket)
		if err != nil {
			return err
		}
		b, err = b.CreateBucketIfNotExists([]byte(transport.Name()))
		if err != nil {
			return err
		}
		b, err = b.CreateBucketIfNotExists([]byte(scope.Opaque))
		if err != nil {
			return err
		}
		b, err = b.CreateBucketIfNotExists([]byte(blobDigest.String()))
		if err != nil {
			return err
		}
		value, err := time.Now().MarshalBinary()
		if err != nil {
			return err
		}
		if err := b.Put([]byte(location.Opaque), value); err != nil { // Possibly overwriting an older entry.
			return err
		}
		return nil
	}) // FIXME? Log error (but throttle the log volume on repeated accesses)?
}
func ( bdc * cache ) RecordKnownLocation ( transport types . ImageTransport , scope types . BICTransportScope , blobDigest digest . Digest , location types . BICLocationReference ) { _ = bdc . update ( func ( tx * bolt . Tx ) error { b , err := tx . CreateBucketIfNotExists ( knownLocationsBucket ) if err != nil { return err } b , err = b . CreateBucketIfNotExists ( [ ] byte ( transport . Name ( ) ) ) if err != nil { return err } b , err = b . CreateBucketIfNotExists ( [ ] byte ( scope . Opaque ) ) if err != nil { return err } b , err = b . CreateBucketIfNotExists ( [ ] byte ( blobDigest . String ( ) ) ) if err != nil { return err } value , err := time . Now ( ) . MarshalBinary ( ) if err != nil { return err } if err := b . Put ( [ ] byte ( location . Opaque ) , value ) ; err != nil { // Possibly overwriting an older entry. return err } return nil } ) // FIXME? Log error (but throttle the log volume on repeated accesses)? }
// RecordKnownLocation records that a blob with the specified digest exists within the specified (transport, scope) scope,
// and can be reused given the opaque location data.
RecordKnownLocation records that a blob with the specified digest exists within the specified ( transport scope ) scope and can be reused given the opaque location data .