[#241] v2/session: Define keys of the well-known X-headers

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
remotes/KirillovDenis/feature/refactor-sig-rpc
Leonard Lyubich 2021-01-11 18:14:07 +03:00 committed by Alex Vanin
parent aa55079b69
commit f8018f9c3d
3 changed files with 36 additions and 2 deletions

View File

@ -176,7 +176,7 @@ type CreateRequest_Body struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Dession initiating user's or node's key derived `OwnerID`.
// Session initiating user's or node's key derived `OwnerID`
OwnerId *grpc.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"`
// Session expiration `Epoch`
Expiration uint64 `protobuf:"varint,2,opt,name=expiration,proto3" json:"expiration,omitempty"`

View File

@ -218,7 +218,25 @@ func (x *SessionToken) GetSignature() *grpc.Signature {
return nil
}
// Extended headers for Request/Response.
// Extended headers for Request/Response. May contain any user-defined headers
// to be interpreted on application level.
//
// Key name must be unique valid UTF-8 string. Value can't be empty. Requests or
// Responses with duplicated header names or headers with empty values will be
// considered invalid.
//
// There are some "well-known" headers starting with `__NEOFS__` prefix that
// affect system behaviour:
//
// * __NEOFS__NETMAP_EPOCH \
// Netmap epoch to use for object placement calculation. The `value` is string
// encoded `uint64` in decimal presentation. If set to '0' or not set, the
// current epoch only will be used.
// * __NEOFS__NETMAP_LOOKUP_DEPTH \
// If object can't be found using current epoch's netmap, this header limits
// how many past epochs back the node can lookup. The `value` is string
// encoded `uint64` in decimal presentation. If set to '0' or not set, the
// current epoch only will be used.
type XHeader struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache

View File

@ -0,0 +1,16 @@
package session
// ReservedXHeaderPrefix is a prefix of keys to "well-known" X-headers.
const ReservedXHeaderPrefix = "__NEOFS__"
const (
// XHeaderNetmapEpoch is a key to the reserved X-header that specifies netmap epoch
// to use for object placement calculation. If set to '0' or not set, the current
// epoch only will be used.
XHeaderNetmapEpoch = ReservedXHeaderPrefix + "NETMAP_EPOCH"
// XHeaderNetmapLookupDepth is a key to the reserved X-header that limits
// how many past epochs back the node will can lookup. If set to '0' or not
// set, the current epoch only will be used.
XHeaderNetmapLookupDepth = ReservedXHeaderPrefix + "NETMAP_LOOKUP_DEPTH"
)