session

package
v1.0.0-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 8 Imported by: 38

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyToAllContainers

func ApplyToAllContainers(c *ContainerContext)

ApplyToAllContainers is a helper function that conveniently applies ContainerContext to all containers.

Types

type ContainerContext

type ContainerContext session.ContainerSessionContext

ContainerContext represents NeoFS API v2-compatible context of the container session.

It is a wrapper over session.ContainerSessionContext which allows to abstract from details of the message structure.

func GetContainerContext

func GetContainerContext(t *Token) *ContainerContext

GetContainerContext is a helper function that casts Token context to ContainerContext.

Returns nil if context is not a ContainerContext.

func NewContainerContext

func NewContainerContext() *ContainerContext

NewContainerContext creates and returns blank ContainerSessionContext.

Defaults:

  • not bound to any operation;
  • applied to all containers.

func NewContainerContextFromV2

func NewContainerContextFromV2(v *session.ContainerSessionContext) *ContainerContext

NewContainerContextFromV2 wraps session.ContainerSessionContext into ContainerContext.

func (*ContainerContext) ApplyTo

func (x *ContainerContext) ApplyTo(id *cid.ID)

ApplyTo specifies which container the ContainerContext applies to.

If id is nil, ContainerContext is applied to all containers.

func (*ContainerContext) Container

func (x *ContainerContext) Container() *cid.ID

Container returns identifier of the container to which the ContainerContext applies.

Returns nil if ContainerContext is applied to all containers.

func (*ContainerContext) ForDelete

func (x *ContainerContext) ForDelete()

ForDelete binds the ContainerContext to DELETE operation.

func (*ContainerContext) ForPut

func (x *ContainerContext) ForPut()

ForPut binds the ContainerContext to PUT operation.

func (*ContainerContext) ForSetEACL

func (x *ContainerContext) ForSetEACL()

ForSetEACL binds the ContainerContext to SETEACL operation.

func (*ContainerContext) IsForDelete

func (x *ContainerContext) IsForDelete() bool

IsForDelete checks if ContainerContext is bound to DELETE operation.

func (*ContainerContext) IsForPut

func (x *ContainerContext) IsForPut() bool

IsForPut checks if ContainerContext is bound to PUT operation.

func (*ContainerContext) IsForSetEACL

func (x *ContainerContext) IsForSetEACL() bool

IsForSetEACL checks if ContainerContext is bound to SETEACL operation.

func (*ContainerContext) Marshal

func (x *ContainerContext) Marshal() ([]byte, error)

Marshal marshals ContainerContext into a protobuf binary form.

func (*ContainerContext) MarshalJSON

func (x *ContainerContext) MarshalJSON() ([]byte, error)

MarshalJSON encodes ContainerContext to protobuf JSON format.

func (*ContainerContext) ToV2

ToV2 converts ContainerContext to session.ContainerSessionContext message structure.

func (*ContainerContext) Unmarshal

func (x *ContainerContext) Unmarshal(data []byte) error

Unmarshal unmarshals protobuf binary representation of ContainerContext.

func (*ContainerContext) UnmarshalJSON

func (x *ContainerContext) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes ContainerContext from protobuf JSON format.

type ObjectContext

type ObjectContext session.ObjectSessionContext

ObjectContext represents NeoFS API v2-compatible context of the object session.

It is a wrapper over session.ObjectSessionContext which allows abstracting from details of the message structure.

func NewObjectContext

func NewObjectContext() *ObjectContext

NewObjectContext creates and returns blank ObjectContext.

Defaults:

  • not bound to any operation;
  • nil object address.

func NewObjectContextFromV2

func NewObjectContextFromV2(v *session.ObjectSessionContext) *ObjectContext

NewObjectContextFromV2 wraps session.ObjectSessionContext into ObjectContext.

func (*ObjectContext) Address

func (x *ObjectContext) Address() *address.Address

Address returns identifier of the object to which the ObjectContext applies.

func (*ObjectContext) ApplyTo

func (x *ObjectContext) ApplyTo(id *address.Address)

ApplyTo specifies which object the ObjectContext applies to.

func (*ObjectContext) ForDelete

func (x *ObjectContext) ForDelete()

ForDelete binds the ObjectContext to DELETE operation.

func (*ObjectContext) ForGet

func (x *ObjectContext) ForGet()

ForGet binds the ObjectContext to GET operation.

func (*ObjectContext) ForHead

func (x *ObjectContext) ForHead()

ForHead binds the ObjectContext to HEAD operation.

func (*ObjectContext) ForPut

func (x *ObjectContext) ForPut()

ForPut binds the ObjectContext to PUT operation.

func (*ObjectContext) ForRange

func (x *ObjectContext) ForRange()

ForRange binds the ObjectContext to RANGE operation.

func (*ObjectContext) ForRangeHash

func (x *ObjectContext) ForRangeHash()

ForRangeHash binds the ObjectContext to RANGEHASH operation.

func (*ObjectContext) ForSearch

func (x *ObjectContext) ForSearch()

ForSearch binds the ObjectContext to SEARCH operation.

func (*ObjectContext) IsForDelete

func (x *ObjectContext) IsForDelete() bool

IsForDelete checks if ObjectContext is bound to DELETE operation.

func (*ObjectContext) IsForGet

func (x *ObjectContext) IsForGet() bool

IsForGet checks if ObjectContext is bound to GET operation.

func (*ObjectContext) IsForHead

func (x *ObjectContext) IsForHead() bool

IsForHead checks if ObjectContext is bound to HEAD operation.

func (*ObjectContext) IsForPut

func (x *ObjectContext) IsForPut() bool

IsForPut checks if ObjectContext is bound to PUT operation.

func (*ObjectContext) IsForRange

func (x *ObjectContext) IsForRange() bool

IsForRange checks if ObjectContext is bound to RANGE operation.

func (*ObjectContext) IsForRangeHash

func (x *ObjectContext) IsForRangeHash() bool

IsForRangeHash checks if ObjectContext is bound to RANGEHASH operation.

func (*ObjectContext) IsForSearch

func (x *ObjectContext) IsForSearch() bool

IsForSearch checks if ObjectContext is bound to SEARCH operation.

func (*ObjectContext) Marshal

func (x *ObjectContext) Marshal() ([]byte, error)

Marshal marshals ObjectContext into a protobuf binary form.

func (*ObjectContext) MarshalJSON

func (x *ObjectContext) MarshalJSON() ([]byte, error)

MarshalJSON encodes ObjectContext to protobuf JSON format.

func (*ObjectContext) ToV2

ToV2 converts ObjectContext to session.ObjectSessionContext message structure.

func (*ObjectContext) Unmarshal

func (x *ObjectContext) Unmarshal(data []byte) error

Unmarshal unmarshals protobuf binary representation of ObjectContext.

func (*ObjectContext) UnmarshalJSON

func (x *ObjectContext) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes ObjectContext from protobuf JSON format.

type Token

type Token session.Token

Token represents NeoFS API v2-compatible session token.

func NewToken

func NewToken() *Token

NewToken creates and returns blank Token.

Defaults:

  • body: nil;
  • id: nil;
  • ownerId: nil;
  • sessionKey: nil;
  • exp: 0;
  • iat: 0;
  • nbf: 0;

func NewTokenFromV2

func NewTokenFromV2(tV2 *session.Token) *Token

NewTokenFromV2 wraps session.Token message structure into Token.

Nil session.Token converts to nil.

func (*Token) Context

func (t *Token) Context() interface{}

Context returns context of the Token.

Supports same contexts as SetContext.

Returns nil if context is not supported.

func (*Token) Exp

func (t *Token) Exp() uint64

Exp returns epoch number of the token expiration.

func (*Token) ID

func (t *Token) ID() []byte

ID returns Token identifier.

func (*Token) Iat

func (t *Token) Iat() uint64

Iat returns starting epoch number of the token.

func (*Token) Marshal

func (t *Token) Marshal() ([]byte, error)

Marshal marshals Token into a protobuf binary form.

func (*Token) MarshalJSON

func (t *Token) MarshalJSON() ([]byte, error)

MarshalJSON encodes Token to protobuf JSON format.

func (*Token) Nbf

func (t *Token) Nbf() uint64

Nbf returns starting epoch number of the token.

func (*Token) OwnerID

func (t *Token) OwnerID() *owner.ID

OwnerID returns Token's owner identifier.

func (*Token) SessionKey

func (t *Token) SessionKey() []byte

SessionKey returns public key of the session in a binary format.

func (*Token) SetContext

func (t *Token) SetContext(v interface{})

SetContext sets context of the Token.

Supported contexts:

  • *ContainerContext,
  • *ObjectContext.

Resets context if it is not supported.

func (*Token) SetExp

func (t *Token) SetExp(exp uint64)

SetExp sets epoch number of the token expiration.

func (*Token) SetID

func (t *Token) SetID(v []byte)

SetID sets Token identifier.

func (*Token) SetIat

func (t *Token) SetIat(iat uint64)

SetIat sets the number of the epoch in which the token was issued.

func (*Token) SetNbf

func (t *Token) SetNbf(nbf uint64)

SetNbf sets starting epoch number of the token.

func (*Token) SetOwnerID

func (t *Token) SetOwnerID(v *owner.ID)

SetOwnerID sets Token's owner identifier.

func (*Token) SetSessionKey

func (t *Token) SetSessionKey(v []byte)

SetSessionKey sets public key of the session in a binary format.

func (*Token) Sign

func (t *Token) Sign(key *ecdsa.PrivateKey) error

Sign calculates and writes signature of the Token data.

Returns signature calculation errors.

func (*Token) Signature

func (t *Token) Signature() *signature.Signature

Signature returns Token signature.

func (*Token) ToV2

func (t *Token) ToV2() *session.Token

ToV2 converts Token to session.Token message structure.

Nil Token converts to nil.

func (*Token) Unmarshal

func (t *Token) Unmarshal(data []byte) error

Unmarshal unmarshals protobuf binary representation of Token.

func (*Token) UnmarshalJSON

func (t *Token) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes Token from protobuf JSON format.

func (*Token) VerifySignature

func (t *Token) VerifySignature() bool

VerifySignature checks if token signature is presented and valid.

type XHeader

type XHeader session.XHeader

XHeader represents v2-compatible XHeader.

func NewXHeader

func NewXHeader() *XHeader

NewXHeader creates, initializes and returns blank XHeader instance.

Defaults:

  • key: "";
  • value: "".

func NewXHeaderFromV2

func NewXHeaderFromV2(v *session.XHeader) *XHeader

NewXHeaderFromV2 wraps v2 XHeader message to XHeader.

Nil session.XHeader converts to nil.

func (*XHeader) Key

func (x *XHeader) Key() string

Key returns key to X-Header.

func (*XHeader) SetKey

func (x *XHeader) SetKey(k string)

SetKey sets key to X-Header.

func (*XHeader) SetValue

func (x *XHeader) SetValue(k string)

SetValue sets value of X-Header.

func (*XHeader) ToV2

func (x *XHeader) ToV2() *session.XHeader

ToV2 converts XHeader to v2 XHeader message.

Nil XHeader converts to nil.

func (*XHeader) Value

func (x *XHeader) Value() string

Value returns value of X-Header.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL