eacl

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HdrObjSysNameID is a name of ID field in system header of object.
	HdrObjSysNameID = "ID"

	// HdrObjSysNameCID is a name of CID field in system header of object.
	HdrObjSysNameCID = "CID"

	// HdrObjSysNameOwnerID is a name of OwnerID field in system header of object.
	HdrObjSysNameOwnerID = "OWNER_ID"

	// HdrObjSysNameVersion is a name of Version field in system header of object.
	HdrObjSysNameVersion = "VERSION"

	// HdrObjSysNamePayloadLength is a name of PayloadLength field in system header of object.
	HdrObjSysNamePayloadLength = "PAYLOAD_LENGTH"

	// HdrObjSysNameCreatedUnix is a name of CreatedAt.UnitTime field in system header of object.
	HdrObjSysNameCreatedUnix = "CREATED_UNIX"

	// HdrObjSysNameCreatedEpoch is a name of CreatedAt.Epoch field in system header of object.
	HdrObjSysNameCreatedEpoch = "CREATED_EPOCH"

	// HdrObjSysLinkPrev is a name of previous link header in extended headers of object.
	HdrObjSysLinkPrev = "LINK_PREV"

	// HdrObjSysLinkNext is a name of next link header in extended headers of object.
	HdrObjSysLinkNext = "LINK_NEXT"

	// HdrObjSysLinkChild is a name of child link header in extended headers of object.
	HdrObjSysLinkChild = "LINK_CHILD"

	// HdrObjSysLinkPar is a name of parent link header in extended headers of object.
	HdrObjSysLinkPar = "LINK_PAR"

	// HdrObjSysLinkSG is a name of storage group link header in extended headers of object.
	HdrObjSysLinkSG = "LINK_SG"
)

Variables

This section is empty.

Functions

func MarshalTable

func MarshalTable(table Table) []byte

MarshalTable encodes Table into a binary form and returns the result.

If table is nil, empty slice is returned.

Types

type Action

type Action uint32

Action is an enumeration of extended ACL actions.

const (
	// ActionUnknown is Action used to mark value as undefined.
	// Most of the tools consider ActionUnknown as incalculable.
	// Using ActionUnknown in Record is unsafe.
	ActionUnknown Action = iota

	// ActionAllow is Action used to mark an applicability of ACL rule.
	ActionAllow

	// ActionDeny is Action used to mark an inapplicability of ACL rule.
	ActionDeny
)

type FilterWrapper

type FilterWrapper struct {
	// contains filtered or unexported fields
}

FilterWrapper is a wrapper over acl.EACLRecord_FilterInfo pointer.

func WrapFilterInfo

func WrapFilterInfo(v *acl.EACLRecord_FilterInfo) FilterWrapper

WrapFilterInfo wraps EACLRecord_FilterInfo pointer.

If argument is nil, new EACLRecord_FilterInfo is initialized.

func (FilterWrapper) HeaderType

func (s FilterWrapper) HeaderType() (res HeaderType)

HeaderType returns the header type of the filter.

If filter is not initialized, HdrTypeUnknown returns.

Returns HdrTypeUnknown if Header is not one of:

  • EACLRecord_FilterInfo_Request;
  • EACLRecord_FilterInfo_ObjectSystem;
  • EACLRecord_FilterInfo_ObjectUser.

func (FilterWrapper) MatchType

func (s FilterWrapper) MatchType() (res MatchType)

MatchType returns the match type of the filter.

If filter is not initialized, 0 returns.

Returns 0 if MatchType is not one of:

  • EACLRecord_FilterInfo_StringEqual;
  • EACLRecord_FilterInfo_StringNotEqual.

func (FilterWrapper) Name

func (s FilterWrapper) Name() string

Name returns the name of filtering header.

If filter is not initialized, empty string returns.

func (FilterWrapper) SetHeaderType

func (s FilterWrapper) SetHeaderType(t HeaderType)

SetHeaderType sets the header type of the filter.

If filter is not initialized, nothing changes.

Header is set to EACLRecord_FilterInfo_HeaderUnknown if argument is not one of:

  • HdrTypeRequest;
  • HdrTypeObjSys;
  • HdrTypeObjUsr.

func (FilterWrapper) SetMatchType

func (s FilterWrapper) SetMatchType(v MatchType)

SetMatchType sets the match type of the filter.

If filter is not initialized, nothing changes.

MatchType is set to EACLRecord_FilterInfo_MatchUnknown if argument is not one of:

  • StringEqual;
  • StringNotEqual.

func (FilterWrapper) SetName

func (s FilterWrapper) SetName(v string)

SetName sets the name of the filtering header.

If filter is not initialized, nothing changes.

func (FilterWrapper) SetValue

func (s FilterWrapper) SetValue(v string)

SetValue sets the value of filtering header.

If filter is not initialized, nothing changes.

func (FilterWrapper) Value

func (s FilterWrapper) Value() string

Value returns the value of filtering header.

If filter is not initialized, empty string returns.

type Group

type Group uint32

Group is an enumeration of access groups.

const (
	// GroupUnknown is a Group value used to mark value as undefined.
	// Most of the tools consider GroupUnknown as incalculable.
	// Using GroupUnknown in Target is unsafe.
	GroupUnknown Group = iota

	// GroupUser is a Group value for User access group.
	GroupUser

	// GroupSystem is a Group value for System access group.
	GroupSystem

	// GroupOthers is a Group value for Others access group.
	GroupOthers
)
type Header interface {
	// Must return string identifier of header.
	Name() string

	// Must return string value of header.
	Value() string
}

Header is an interface of string key-value pair,

type HeaderFilter

type HeaderFilter interface {
	// Must return match type of filter.
	MatchType() MatchType

	TypedHeader
}

HeaderFilter is an interface of grouped information about filtered header.

type HeaderType

type HeaderType uint32

HeaderType is an enumeration of header types for extended ACL.

const (
	// HdrTypeUnknown is a HeaderType value used to mark value as undefined.
	// Most of the tools consider HdrTypeUnknown as incalculable.
	// Using HdrTypeUnknown in HeaderFilter is unsafe.
	HdrTypeUnknown HeaderType = iota

	// HdrTypeRequest is a HeaderType for request header.
	HdrTypeRequest

	// HdrTypeObjSys is a HeaderType for system headers of object.
	HdrTypeObjSys

	// HdrTypeObjUsr is a HeaderType for user headers of object.
	HdrTypeObjUsr
)

type MatchType

type MatchType uint32

MatchType is an enumeration of match types for extended ACL.

const (
	// MatchUnknown is a MatchType value used to mark value as undefined.
	// Most of the tools consider MatchUnknown as incalculable.
	// Using MatchUnknown in HeaderFilter is unsafe.
	MatchUnknown MatchType = iota

	// StringEqual is a MatchType of string equality.
	StringEqual

	// StringNotEqual is a MatchType of string inequality.
	StringNotEqual
)

type OperationType

type OperationType uint32

OperationType is an enumeration of operation types for extended ACL.

const (
	// OpTypeUnknown is a OperationType value used to mark value as undefined.
	// Most of the tools consider OpTypeUnknown as incalculable.
	// Using OpTypeUnknown in Record is unsafe.
	OpTypeUnknown OperationType = iota

	// OpTypeGet is an OperationType for object.Get RPC
	OpTypeGet

	// OpTypePut is an OperationType for object.Put RPC
	OpTypePut

	// OpTypeHead is an OperationType for object.Head RPC
	OpTypeHead

	// OpTypeSearch is an OperationType for object.Search RPC
	OpTypeSearch

	// OpTypeDelete is an OperationType for object.Delete RPC
	OpTypeDelete

	// OpTypeRange is an OperationType for object.GetRange RPC
	OpTypeRange

	// OpTypeRangeHash is an OperationType for object.GetRangeHash RPC
	OpTypeRangeHash
)

type Record

type Record interface {
	// Must return operation type of extended ACL rule.
	OperationType() OperationType

	// Must return list of header filters of extended ACL rule.
	HeaderFilters() []HeaderFilter

	// Must return target list of extended ACL rule.
	TargetList() []Target

	// Must return action of extended ACL rule.
	Action() Action
}

Record is an interface of record of extended ACL rule table.

type RecordWrapper

type RecordWrapper struct {
	// contains filtered or unexported fields
}

RecordWrapper is a wrapper over acl.EACLRecord pointer.

func WrapRecord

func WrapRecord(v *acl.EACLRecord) RecordWrapper

WrapRecord wraps EACLRecord pointer.

If argument is nil, new EACLRecord is initialized.

func (RecordWrapper) Action

func (s RecordWrapper) Action() (res Action)

Action returns the action of the record.

If record is not initialized, ActionUnknown returns.

Returns ActionUnknown if Action is not one of:

  • EACLRecord_Deny;
  • EACLRecord_Allow.

func (RecordWrapper) HeaderFilters

func (s RecordWrapper) HeaderFilters() []HeaderFilter

HeaderFilters returns the header filter list of the record.

If record is not initialized, nil returns.

func (RecordWrapper) OperationType

func (s RecordWrapper) OperationType() (res OperationType)

OperationType returns the operation type of the record.

If record is not initialized, OpTypeUnknown returns.

Returns OpTypeUnknown if Operation is not one of:

  • EACLRecord_HEAD;
  • EACLRecord_PUT;
  • EACLRecord_SEARCH;
  • EACLRecord_GET;
  • EACLRecord_GETRANGE;
  • EACLRecord_GETRANGEHASH;
  • EACLRecord_DELETE.

func (RecordWrapper) SetAction

func (s RecordWrapper) SetAction(v Action)

SetAction sets the action of the record.

If record is not initialized, nothing changes.

Action is set to EACLRecord_ActionUnknown if argument is not one of:

  • ActionDeny;
  • ActionAllow.

func (RecordWrapper) SetHeaderFilters

func (s RecordWrapper) SetHeaderFilters(v []HeaderFilter)

SetHeaderFilters sets the header filter list of the record.

Ignores nil elements of argument. If record is not initialized, nothing changes.

func (RecordWrapper) SetOperationType

func (s RecordWrapper) SetOperationType(v OperationType)

SetOperationType sets the operation type of the record.

If record is not initialized, nothing changes.

Operation is set to EACLRecord_OPERATION_UNKNOWN if argument is not one of:

  • OpTypeHead;
  • OpTypePut;
  • OpTypeSearch;
  • OpTypeGet;
  • OpTypeRange;
  • OpTypeRangeHash;
  • OpTypeDelete.

func (RecordWrapper) SetTargetList

func (s RecordWrapper) SetTargetList(v []Target)

SetTargetList sets the target list of the record.

Ignores nil elements of argument. If record is not initialized, nothing changes.

func (RecordWrapper) TargetList

func (s RecordWrapper) TargetList() []Target

TargetList returns the target list of the record.

If record is not initialized, nil returns.

type Table

type Table interface {
	// Must return list of extended ACL rules.
	Records() []Record
}

Table is an interface of extended ACL table.

func UnmarshalTable

func UnmarshalTable(data []byte) (Table, error)

UnmarshalTable unmarshals Table from a binary representation.

If data is empty, table w/o records is returned.

type TableWrapper

type TableWrapper struct {
	// contains filtered or unexported fields
}

TableWrapper is a wrapper over acl.EACLTable pointer.

func WrapTable

func WrapTable(v *acl.EACLTable) TableWrapper

WrapTable wraps EACLTable pointer.

If argument is nil, new EACLTable is initialized.

func (TableWrapper) Records

func (s TableWrapper) Records() []Record

Records returns the record list of the table.

If table is not initialized, nil returns.

func (TableWrapper) SetRecords

func (s TableWrapper) SetRecords(v []Record)

SetRecords sets the record list of the table.

Ignores nil elements of argument. If table is not initialized, nothing changes.

type Target

type Target interface {
	// Must return ACL target type.
	Group() Group

	// Must return public key list of ACL targets.
	KeyList() [][]byte
}

Target is an interface of grouped information about extended ACL rule target.

type TargetWrapper

type TargetWrapper struct {
	// contains filtered or unexported fields
}

TargetWrapper is a wrapper over acl.EACLRecord_TargetInfo pointer.

func WrapTarget

WrapTarget wraps EACLRecord_TargetInfo pointer.

If argument is nil, new EACLRecord_TargetInfo is initialized.

func (TargetWrapper) Group

func (s TargetWrapper) Group() (res Group)

Group returns the access group of the target.

If target is not initialized, GroupUnknown returns.

Returns GroupUnknown if Target is not one of:

  • Target_User;
  • GroupSystem;
  • GroupOthers.

func (TargetWrapper) KeyList

func (s TargetWrapper) KeyList() [][]byte

KeyList returns the key list of the target.

If target is not initialized, nil returns.

func (TargetWrapper) SetGroup

func (s TargetWrapper) SetGroup(g Group)

SetGroup sets the access group of the target.

If target is not initialized, nothing changes.

Target is set to Target_Unknown if argument is not one of:

  • GroupUser;
  • GroupSystem;
  • GroupOthers.

func (TargetWrapper) SetKeyList

func (s TargetWrapper) SetKeyList(v [][]byte)

SetKeyList sets the key list of the target.

If target is not initialized, nothing changes.

type TypedHeader

type TypedHeader interface {
	Header

	// Must return type of filtered header.
	HeaderType() HeaderType
}

TypedHeader is an interface of Header and HeaderType pair.

Jump to

Keyboard shortcuts

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