From a610c39a9f57abecbfa418c023a9d2bf66292622 Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Sat, 15 Jun 2024 15:59:43 +0530 Subject: [PATCH] remove alloc size check --- zboxcore/sdk/chunked_upload.go | 13 ------------- zboxcore/sdk/upload_worker.go | 28 ---------------------------- 2 files changed, 41 deletions(-) diff --git a/zboxcore/sdk/chunked_upload.go b/zboxcore/sdk/chunked_upload.go index e0713f683..f30f318ef 100644 --- a/zboxcore/sdk/chunked_upload.go +++ b/zboxcore/sdk/chunked_upload.go @@ -142,24 +142,11 @@ func CreateChunkedUpload( } opCode := OpUpload - spaceLeft := allocationObj.Size - if allocationObj.Stats != nil { - spaceLeft -= allocationObj.Stats.UsedSize - } if isUpdate { - f, err := allocationObj.GetFileMeta(fileMeta.RemotePath) - if err != nil { - return nil, err - } - spaceLeft += f.ActualFileSize opCode = OpUpdate } - if fileMeta.ActualSize > spaceLeft { - return nil, ErrNoEnoughSpaceLeftInAllocation - } - consensus := Consensus{ RWMutex: &sync.RWMutex{}, consensusThresh: allocationObj.consensusThreshold, diff --git a/zboxcore/sdk/upload_worker.go b/zboxcore/sdk/upload_worker.go index f8d42cd83..76021f904 100644 --- a/zboxcore/sdk/upload_worker.go +++ b/zboxcore/sdk/upload_worker.go @@ -7,7 +7,6 @@ import ( "io" "strings" - thrown "github.com/0chain/errors" "github.com/0chain/gosdk/constants" "github.com/0chain/gosdk/core/sys" "github.com/0chain/gosdk/zboxcore/allocationchange" @@ -94,33 +93,6 @@ func (uo *UploadOperation) buildChange(_ []fileref.RefEntity, uid uuid.UUID) []a } func (uo *UploadOperation) Verify(allocationObj *Allocation) error { - if allocationObj == nil { - return thrown.Throw(constants.ErrInvalidParameter, "allocationObj") - } - - if !uo.isUpdate && !allocationObj.CanUpload() || uo.isUpdate && !allocationObj.CanUpdate() { - return thrown.Throw(constants.ErrFileOptionNotPermitted, "file_option_not_permitted ") - } - - err := ValidateRemoteFileName(uo.chunkedUpload.fileMeta.RemoteName) - if err != nil { - return err - } - spaceLeft := allocationObj.Size - if allocationObj.Stats != nil { - spaceLeft -= allocationObj.Stats.UsedSize - } - - if uo.isUpdate { - f, err := allocationObj.GetFileMeta(uo.chunkedUpload.fileMeta.RemotePath) - if err != nil { - return err - } - spaceLeft += f.ActualFileSize - } - if uo.chunkedUpload.fileMeta.ActualSize > spaceLeft { - return ErrNoEnoughSpaceLeftInAllocation - } return nil }