From 1e513625f1564c1c0d21878057cabcd46b154207 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Thu, 2 Apr 2020 14:52:08 +0300 Subject: [PATCH] object: Add `Type()` in `Request` interface BasicACL have set of rules for every request type. ACL will be processed before any request specific handlers. Therefore we need to determine request type in generic request interface, which is used in pre-processors of object service implementation. --- object/service.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/object/service.go b/object/service.go index 589bd95..3a2ca08 100644 --- a/object/service.go +++ b/object/service.go @@ -28,12 +28,13 @@ type ( Token = session.Token // Request defines object rpc requests. - // All object operations must have TTL, Epoch, Container ID and + // All object operations must have TTL, Epoch, Type, Container ID and // permission of usage previous network map. Request interface { service.MetaHeader CID() CID + Type() RequestType AllowPreviousNetMap() bool } ) @@ -169,3 +170,24 @@ func (m *GetRangeRequest) AllowPreviousNetMap() bool { return false } // AllowPreviousNetMap returns permission to use previous network map in object get range hash request. func (m *GetRangeHashRequest) AllowPreviousNetMap() bool { return false } + +// Type returns type of the object put request. +func (m *PutRequest) Type() RequestType { return RequestPut } + +// Type returns type of the object get request. +func (m *GetRequest) Type() RequestType { return RequestGet } + +// Type returns type of the object head request. +func (m *HeadRequest) Type() RequestType { return RequestHead } + +// Type returns type of the object search request. +func (m *SearchRequest) Type() RequestType { return RequestSearch } + +// Type returns type of the object delete request. +func (m *DeleteRequest) Type() RequestType { return RequestDelete } + +// Type returns type of the object get range request. +func (m *GetRangeRequest) Type() RequestType { return RequestRange } + +// Type returns type of the object get range hash request. +func (m *GetRangeHashRequest) Type() RequestType { return RequestRangeHash }