Skip to content

Commit

Permalink
Implement NewBlockListGrowthPolicy (#35)
Browse files Browse the repository at this point in the history
Right now this is unimplemented, which renders LocalBlobAccess unusable in
bb-remote-asset!  Worse still, the UX is an error message that reads like the
fault is on the part of the user.  Let's implement the same policy as in
ProtoBlobAccessCreator (as this stores protos, like the Action Cache).
  • Loading branch information
tomcoldrick-ct authored Mar 11, 2024
1 parent 490b964 commit a116bef
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/storage/blobstore/asset_blob_access_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ func (bac *assetBlobAccessCreator) GetDefaultCapabilitiesProvider() capabilities
})
}

func (bac *assetBlobAccessCreator) NewBlockListGrowthPolicy(int, int) (local.BlockListGrowthPolicy, error) {
return nil, status.Error(codes.Unimplemented, "NewBlockListGrowthPolicy unimplemeted for assetBlobAccessCreator")
func (bac *assetBlobAccessCreator) NewBlockListGrowthPolicy(currentBlocks, newBlocks int) (local.BlockListGrowthPolicy, error) {
if newBlocks != 1 {
return nil, status.Error(codes.InvalidArgument, "The number of \"new\" blocks must be set to 1 for this storage type, as objects cannot be updated reliably otherwise")
}
return local.NewMutableBlockListGrowthPolicy(currentBlocks), nil
}

func (bac *assetBlobAccessCreator) NewHierarchicalInstanceNamesLocalBlobAccess(local.KeyLocationMap, local.LocationBlobMap, *sync.RWMutex) (blobstore.BlobAccess, error) {
Expand Down

0 comments on commit a116bef

Please # to comment.