Skip to content

Commit

Permalink
undo unnecessary change
Browse files Browse the repository at this point in the history
  • Loading branch information
Tulsishah committed Dec 27, 2024
1 parent 8b2ea3e commit 1b89dd3
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions internal/storage/fake/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ func (b *bucket) checkInvariants() {
//
// LOCKS_REQUIRED(b.mu)
func (b *bucket) mintObject(
req *gcs.CreateObjectRequest,
contents []byte) (o fakeObject) {
req *gcs.CreateObjectRequest,
contents []byte) (o fakeObject) {
md5Sum := md5.Sum(contents)
crc32c := crc32.Checksum(contents, crc32cTable)

Expand Down Expand Up @@ -413,7 +413,7 @@ func createOrUpdateFakeObject(b *bucket, req *gcs.CreateObjectRequest, contents

// LOCKS_REQUIRED(b.mu)
func (b *bucket) createObjectLocked(
req *gcs.CreateObjectRequest) (o *gcs.Object, err error) {
req *gcs.CreateObjectRequest) (o *gcs.Object, err error) {
// Check that the name is legal.
err = checkName(req.Name)
if err != nil {
Expand All @@ -437,7 +437,7 @@ func (b *bucket) createObjectLocked(
//
// LOCKS_REQUIRED(b.mu)
func (b *bucket) newReaderLocked(
req *gcs.ReadObjectRequest) (r io.Reader, index int, err error) {
req *gcs.ReadObjectRequest) (r io.Reader, index int, err error) {
// Find the object with the requested name.
index = b.objects.find(req.Name)
if index == len(b.objects) {
Expand Down Expand Up @@ -544,8 +544,8 @@ func (b *bucket) BucketType() gcs.BucketType {

// LOCKS_EXCLUDED(b.mu)
func (b *bucket) ListObjects(
ctx context.Context,
req *gcs.ListObjectsRequest) (listing *gcs.Listing, err error) {
ctx context.Context,
req *gcs.ListObjectsRequest) (listing *gcs.Listing, err error) {
b.mu.Lock()
defer b.mu.Unlock()

Expand Down Expand Up @@ -593,7 +593,7 @@ func (b *bucket) ListObjects(
// Save the result, but only if it's not a duplicate.
resultPrefix := name[:resultPrefixLimit]
if len(listing.CollapsedRuns) == 0 ||
listing.CollapsedRuns[len(listing.CollapsedRuns)-1] != resultPrefix {
listing.CollapsedRuns[len(listing.CollapsedRuns)-1] != resultPrefix {
listing.CollapsedRuns = append(listing.CollapsedRuns, resultPrefix)
}

Expand Down Expand Up @@ -660,8 +660,8 @@ func (b *bucket) ListObjects(

// LOCKS_EXCLUDED(b.mu)
func (b *bucket) NewReader(
ctx context.Context,
req *gcs.ReadObjectRequest) (rc io.ReadCloser, err error) {
ctx context.Context,
req *gcs.ReadObjectRequest) (rc io.ReadCloser, err error) {
b.mu.Lock()
defer b.mu.Unlock()

Expand All @@ -676,8 +676,8 @@ func (b *bucket) NewReader(

// LOCKS_EXCLUDED(b.mu)
func (b *bucket) CreateObject(
ctx context.Context,
req *gcs.CreateObjectRequest) (o *gcs.Object, err error) {
ctx context.Context,
req *gcs.CreateObjectRequest) (o *gcs.Object, err error) {
b.mu.Lock()
defer b.mu.Unlock()

Expand Down Expand Up @@ -707,8 +707,8 @@ func (b *bucket) FinalizeUpload(ctx context.Context, w gcs.Writer) (*gcs.MinObje

// LOCKS_EXCLUDED(b.mu)
func (b *bucket) CopyObject(
ctx context.Context,
req *gcs.CopyObjectRequest) (o *gcs.Object, err error) {
ctx context.Context,
req *gcs.CopyObjectRequest) (o *gcs.Object, err error) {
b.mu.Lock()
defer b.mu.Unlock()

Expand All @@ -730,7 +730,7 @@ func (b *bucket) CopyObject(

// Does it have the correct generation?
if req.SrcGeneration != 0 &&
b.objects[srcIndex].metadata.Generation != req.SrcGeneration {
b.objects[srcIndex].metadata.Generation != req.SrcGeneration {
err = &gcs.NotFoundError{
Err: fmt.Errorf(
"object %s generation %d not found", req.SrcName, req.SrcGeneration),
Expand Down Expand Up @@ -778,8 +778,8 @@ func (b *bucket) CopyObject(

// LOCKS_EXCLUDED(b.mu)
func (b *bucket) ComposeObjects(
ctx context.Context,
req *gcs.ComposeObjectsRequest) (o *gcs.Object, err error) {
ctx context.Context,
req *gcs.ComposeObjectsRequest) (o *gcs.Object, err error) {
b.mu.Lock()
defer b.mu.Unlock()

Expand Down Expand Up @@ -853,7 +853,7 @@ func (b *bucket) ComposeObjects(

// LOCKS_EXCLUDED(b.mu)
func (b *bucket) StatObject(ctx context.Context,
req *gcs.StatObjectRequest) (m *gcs.MinObject, e *gcs.ExtendedObjectAttributes, err error) {
req *gcs.StatObjectRequest) (m *gcs.MinObject, e *gcs.ExtendedObjectAttributes, err error) {
// If ExtendedObjectAttributes are requested without fetching from gcs enabled, panic.
if !req.ForceFetchFromGcs && req.ReturnExtendedObjectAttributes {
panic("invalid StatObjectRequest: ForceFetchFromGcs: false and ReturnExtendedObjectAttributes: true")
Expand Down Expand Up @@ -882,8 +882,8 @@ func (b *bucket) StatObject(ctx context.Context,

// LOCKS_EXCLUDED(b.mu)
func (b *bucket) UpdateObject(
ctx context.Context,
req *gcs.UpdateObjectRequest) (o *gcs.Object, err error) {
ctx context.Context,
req *gcs.UpdateObjectRequest) (o *gcs.Object, err error) {
b.mu.Lock()
defer b.mu.Unlock()

Expand Down Expand Up @@ -913,7 +913,7 @@ func (b *bucket) UpdateObject(

// Does the meta-generation precondition check out?
if req.MetaGenerationPrecondition != nil &&
obj.MetaGeneration != *req.MetaGenerationPrecondition {
obj.MetaGeneration != *req.MetaGenerationPrecondition {
err = &gcs.PreconditionError{
Err: fmt.Errorf(
"object %q has meta-generation %d",
Expand Down Expand Up @@ -969,8 +969,8 @@ func (b *bucket) UpdateObject(

// LOCKS_EXCLUDED(b.mu)
func (b *bucket) DeleteObject(
ctx context.Context,
req *gcs.DeleteObjectRequest) (err error) {
ctx context.Context,
req *gcs.DeleteObjectRequest) (err error) {
b.mu.Lock()
defer b.mu.Unlock()

Expand All @@ -982,7 +982,7 @@ func (b *bucket) DeleteObject(

// Don't do anything if the generation is wrong.
if req.Generation != 0 &&
b.objects[index].metadata.Generation != req.Generation {
b.objects[index].metadata.Generation != req.Generation {
return
}

Expand Down Expand Up @@ -1025,7 +1025,7 @@ func (b *bucket) MoveObject(ctx context.Context, req *gcs.MoveObjectRequest) (*g

// Does it have the correct generation?
if req.SrcGeneration != 0 &&
b.objects[srcIndex].metadata.Generation != req.SrcGeneration {
b.objects[srcIndex].metadata.Generation != req.SrcGeneration {
err = &gcs.NotFoundError{
Err: fmt.Errorf("object %s generation %d not found", req.SrcName, req.SrcGeneration),
}
Expand Down

0 comments on commit 1b89dd3

Please sign in to comment.