diff --git a/client/object_put.go b/client/object_put.go index 46d9855fe..1b50bdfd7 100644 --- a/client/object_put.go +++ b/client/object_put.go @@ -269,6 +269,7 @@ func (x *DefaultObjectWriter) GetResult() ResObjectPut { } // ObjectPutInit initiates writing an object through a remote server using NeoFS API protocol. +// Header length is limited to [object.MaxHeaderLen]. // // The call only opens the transmission channel, explicit recording is done using the [ObjectWriter]. // Exactly one return value is non-nil. Resulting writer must be finally closed. diff --git a/object/fmt.go b/object/fmt.go index 1f03138ad..cccfe8b22 100644 --- a/object/fmt.go +++ b/object/fmt.go @@ -12,6 +12,10 @@ import ( oid "github.com/nspcc-dev/neofs-sdk-go/object/id" ) +// MaxHeaderLen is a maximum allowed length of binary object header to be +// created via NeoFS API protocol. +const MaxHeaderLen = 16 << 10 + var ( errCheckSumMismatch = errors.New("payload checksum mismatch") errCheckSumNotSet = errors.New("payload checksum is not set") diff --git a/object/object.go b/object/object.go index e57ff5ed9..7f6dd4a0f 100644 --- a/object/object.go +++ b/object/object.go @@ -843,3 +843,8 @@ func formatCheck(v2 *object.Object) error { return nil } + +// HeaderLen returns length of the binary header. +func (o *Object) HeaderLen() int { + return (*object.Object)(o).GetHeader().StableSize() +} diff --git a/object/slicer/slicer.go b/object/slicer/slicer.go index bcaab96c4..a1867703f 100644 --- a/object/slicer/slicer.go +++ b/object/slicer/slicer.go @@ -30,7 +30,8 @@ var ( type ObjectWriter interface { // ObjectPutInit initializes and returns a stream of writable data associated // with the object according to its header. Provided header includes at least - // container, owner and object ID fields. + // container, owner and object ID fields. Header length is limited to + // [object.MaxHeaderLen]. // // Signer is required and must not be nil. The operation is executed on behalf of // the account corresponding to the specified Signer, which is taken into account, in particular, for access control. diff --git a/pool/object.go b/pool/object.go index 837a24d75..66c28ac03 100644 --- a/pool/object.go +++ b/pool/object.go @@ -26,6 +26,7 @@ func (p *Pool) actualSigner(signer user.Signer) user.Signer { } // ObjectPutInit initiates writing an object through a remote server using NeoFS API protocol. +// Header length is limited to [object.MaxHeaderLen]. // // Operation is executed within a session automatically created by [Pool] unless parameters explicitly override session settings. //