authnode

package
v2.5.1-rc.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 26 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LRUCacheSize    = 3 << 30
	WriteBufferSize = 4 * util.MB
)
View Source
const (
	ClusterName       = "clusterName"
	ID                = "id"
	IP                = "ip"
	Port              = "port"
	LogLevel          = "logLevel"
	WalDir            = "walDir"
	StoreDir          = "storeDir"
	GroupID           = 1
	ModuleName        = "authnode"
	CfgRetainLogs     = "retainLogs"
	DefaultRetainLogs = 20000

	AuthSecretKey = "authServiceKey"
	AuthRootKey   = "authRootKey"
	EnableHTTPS   = "enableHTTPS"
)

configuration keys

View Source
const (
	AuthService = "AuthService"
)

Keys in the request

Variables

View Source
var AddrDatabase = make(map[uint64]string)

AddrDatabase is a map that stores the address of a given host (e.g., the leader)

Functions

This section is empty.

Types

type AuthProxy

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

AuthProxy wraps the stuff for http and https

type Cluster

type Cluster struct {
	Name string

	DisableAutoAllocate bool

	AuthSecretKey []byte
	AuthRootKey   []byte
	PKIKey        PKIKey
	// contains filtered or unexported fields
}

Cluster stores all the cluster-level information.

func (*Cluster) AddCaps

func (c *Cluster) AddCaps(id string, keyInfo *keystore.KeyInfo) (res *keystore.KeyInfo, err error)

AddCaps add caps to the key

func (*Cluster) CreateNewKey

func (c *Cluster) CreateNewKey(id string, keyInfo *keystore.KeyInfo) (res *keystore.KeyInfo, err error)

CreateNewKey create a new key to the keystore

func (*Cluster) DeleteCaps

func (c *Cluster) DeleteCaps(id string, keyInfo *keystore.KeyInfo) (res *keystore.KeyInfo, err error)

DeleteCaps delete caps from the key

func (*Cluster) DeleteKey

func (c *Cluster) DeleteKey(id string) (res *keystore.KeyInfo, err error)

DeleteKey delete a key from the keystore

func (*Cluster) GetAKInfo

func (c *Cluster) GetAKInfo(accessKey string) (akInfo *keystore.AccessKeyInfo, err error)

GetKey get a key from the AKstore

func (*Cluster) GetKey

func (c *Cluster) GetKey(id string) (res *keystore.KeyInfo, err error)

GetKey get a key from the keystore

type KeystoreFsm

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

KeystoreFsm represents the finite state machine of a keystore

func (*KeystoreFsm) Apply

func (mf *KeystoreFsm) Apply(command []byte, index uint64) (resp interface{}, err error)

Apply implements the interface of raft.StateMachine

func (*KeystoreFsm) ApplyMemberChange

func (mf *KeystoreFsm) ApplyMemberChange(confChange *proto.ConfChange, index uint64) (interface{}, error)

ApplyMemberChange implements the interface of raft.StateMachine

func (*KeystoreFsm) ApplySnapshot

func (mf *KeystoreFsm) ApplySnapshot(peers []proto.Peer, iterator proto.SnapIterator) (err error)

ApplySnapshot implements the interface of raft.StateMachine

func (*KeystoreFsm) Del

func (mf *KeystoreFsm) Del(key interface{}) (interface{}, error)

Del implements the interface of raft.StateMachine

func (*KeystoreFsm) DeleteAKInfo

func (mf *KeystoreFsm) DeleteAKInfo(accessKey string)

func (*KeystoreFsm) DeleteKey

func (mf *KeystoreFsm) DeleteKey(id string)

DeleteKey Delete keyInfo in keystore cache

func (*KeystoreFsm) Get

func (mf *KeystoreFsm) Get(key interface{}) (interface{}, error)

Get implements the interface of raft.StateMachine

func (*KeystoreFsm) GetAKInfo

func (mf *KeystoreFsm) GetAKInfo(accessKey string) (akInfo *keystore.AccessKeyInfo, err error)

func (*KeystoreFsm) GetKey

func (mf *KeystoreFsm) GetKey(id string) (u *keystore.KeyInfo, err error)

GetKey Get keyInfo from keystore cache

func (*KeystoreFsm) HandleFatalEvent

func (mf *KeystoreFsm) HandleFatalEvent(err *raft.FatalError)

HandleFatalEvent implements the interface of raft.StateMachine

func (*KeystoreFsm) HandleLeaderChange

func (mf *KeystoreFsm) HandleLeaderChange(leader uint64)

HandleLeaderChange implements the interface of raft.StateMachine

func (*KeystoreFsm) Put

func (mf *KeystoreFsm) Put(key, val interface{}) (interface{}, error)

Put implements the interface of raft.StateMachine

func (*KeystoreFsm) PutAKInfo

func (mf *KeystoreFsm) PutAKInfo(akInfo *keystore.AccessKeyInfo)

func (*KeystoreFsm) PutKey

func (mf *KeystoreFsm) PutKey(k *keystore.KeyInfo)

PutKey change keyInfo in keystore cache

func (*KeystoreFsm) Snapshot

func (mf *KeystoreFsm) Snapshot() (proto.Snapshot, error)

Snapshot implements the interface of raft.StateMachine

type KeystoreSnapshot

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

KeystoreSnapshot represents the snapshot of a keystore partition

func (*KeystoreSnapshot) ApplyIndex

func (ms *KeystoreSnapshot) ApplyIndex() uint64

ApplyIndex implements the Snapshot interface

func (*KeystoreSnapshot) Close

func (ms *KeystoreSnapshot) Close()

Close implements the Snapshot interface

func (*KeystoreSnapshot) Next

func (ms *KeystoreSnapshot) Next() (data []byte, err error)

Next implements the Snapshot interface

type LeaderInfo

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

LeaderInfo represents the leader's information

type PKIKey

type PKIKey struct {
	EnableHTTPS        bool
	AuthRootPrivateKey []byte
	AuthRootPublicKey  []byte
}

PKIKey defines the pki keys

type RaftCmd

type RaftCmd struct {
	Op uint32 `json:"op"`
	K  string `json:"k"`
	V  []byte `json:"v"`
}

RaftCmd defines the Raft commands.

func (*RaftCmd) Marshal

func (m *RaftCmd) Marshal() ([]byte, error)

Marshal converts the RaftCmd to a byte array.

func (*RaftCmd) Unmarshal

func (m *RaftCmd) Unmarshal(data []byte) (err error)

Unmarshal converts the byte array to a RaftCmd.

type Server

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

Server represents the server in a cluster

func NewServer

func NewServer() *Server

NewServer creates a new server

func (*Server) ServeHTTP

func (m *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) Shutdown

func (m *Server) Shutdown()

Shutdown closes the server

func (*Server) Start

func (m *Server) Start(cfg *config.Config) (err error)

Start starts a server

func (*Server) Sync

func (m *Server) Sync()

Sync waits for the execution termination of the server

Jump to

Keyboard shortcuts

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