forked from TrueCloudLab/frostfs-node
[#1307] object: Implement Patch
method
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
a4a1c3f18b
commit
e890f1b4b1
19 changed files with 430 additions and 81 deletions
|
@ -172,16 +172,18 @@ func (a *auditPutStream) Send(ctx context.Context, req *object.PutRequest) error
|
|||
}
|
||||
|
||||
type auditPatchStream struct {
|
||||
stream PatchObjectstream
|
||||
stream PatchObjectStream
|
||||
log *logger.Logger
|
||||
|
||||
failed bool
|
||||
key []byte
|
||||
containerID *refs.ContainerID
|
||||
objectID *refs.ObjectID
|
||||
|
||||
nonFirstSend bool
|
||||
}
|
||||
|
||||
func (a *auditService) Patch() (PatchObjectstream, error) {
|
||||
func (a *auditService) Patch() (PatchObjectStream, error) {
|
||||
res, err := a.next.Patch()
|
||||
if !a.enabled.Load() {
|
||||
return res, err
|
||||
|
@ -196,7 +198,7 @@ func (a *auditService) Patch() (PatchObjectstream, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// CloseAndRecv implements PutObjectStream.
|
||||
// CloseAndRecv implements PatchObjectStream.
|
||||
func (a *auditPatchStream) CloseAndRecv(ctx context.Context) (*object.PatchResponse, error) {
|
||||
resp, err := a.stream.CloseAndRecv(ctx)
|
||||
if err != nil {
|
||||
|
@ -209,11 +211,14 @@ func (a *auditPatchStream) CloseAndRecv(ctx context.Context) (*object.PatchRespo
|
|||
return resp, err
|
||||
}
|
||||
|
||||
// Send implements PutObjectStream.
|
||||
// Send implements PatchObjectStream.
|
||||
func (a *auditPatchStream) Send(ctx context.Context, req *object.PatchRequest) error {
|
||||
a.containerID = req.GetBody().GetAddress().GetContainerID()
|
||||
a.objectID = req.GetBody().GetAddress().GetObjectID()
|
||||
a.key = req.GetVerificationHeader().GetBodySignature().GetKey()
|
||||
if !a.nonFirstSend {
|
||||
a.containerID = req.GetBody().GetAddress().GetContainerID()
|
||||
a.objectID = req.GetBody().GetAddress().GetObjectID()
|
||||
a.key = req.GetVerificationHeader().GetBodySignature().GetKey()
|
||||
a.nonFirstSend = true
|
||||
}
|
||||
|
||||
err := a.stream.Send(ctx, req)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue