repo

package
v0.0.0-...-a297e19 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeRepo

type NodeRepo interface {
	GetByUniqueID(ctx context.Context, uniqueID string) (*model.Node, error)
	GetByID(ctx context.Context, id int64) (*model.Node, error)
	Create(ctx context.Context, node *model.Node) error
	Delete(ctx context.Context, id int64) error
	List(ctx context.Context, spaceID int64, offset, limit int64) ([]*model.Node, int64, error)
	UpdateLastHeartbeat(ctx context.Context, uniqueID string) error
}

type Repo

type Repo interface {
	BeginTx(ctx context.Context) (Repo, error)
	CommitTx(ctx context.Context) error
	RollbackTx(ctx context.Context) error

	Node() NodeRepo
	Role() RoleRepo
	User() UserRepo
	Space() SpaceRepo
}

type RoleRepo

type RoleRepo interface {
	List(ctx context.Context, spaceID int64) ([]*model.Role, error)
	GetByID(ctx context.Context, id int64) (*model.Role, error)
	Create(ctx context.Context, role *model.Role) error
	Delete(ctx context.Context, id int64) error

	ListRoleNodeByNodeID(ctx context.Context, nodeID int64) ([]*model.RoleNode, error)
	ListNodeByRoleID(ctx context.Context, roleID int64) ([]*model.RoleNodeView, error)
	AddNode(ctx context.Context, roleID, nodeID int64, account string) error
	// RemoveNode remove node from role, if nodeID is empty, remove all nodes from role
	RemoveNode(ctx context.Context, roleID int64, nodeIDs ...int64) error
	GetRoleNodeByRoleIDAndNodeID(ctx context.Context, roleID, nodeID int64) (*model.RoleNode, error)

	ListUserByRoleID(ctx context.Context, roleID int64) ([]*model.User, error)
	AddUser(ctx context.Context, roleID, userID int64) error
	// RemoveUser remove user from role, if userID is empty, remove all users from role
	RemoveUser(ctx context.Context, roleID int64, userIDs ...int64) error
	RemoveUserByUserID(ctx context.Context, userID int64) error
	GetRoleUserByRoleIDAndUserID(ctx context.Context, roleID, userID int64) (*model.RoleUser, error)

	ListRevokedKeys(ctx context.Context, nodeID int64) ([]int64, error)
	ListUserPublicKeyByRoleID(ctx context.Context, roleID int64) ([]string, error)
}

type SpaceRepo

type SpaceRepo interface {
	GetByName(ctx context.Context, name string) (*model.Space, error)
	GetByID(ctx context.Context, spaceID int64) (*model.Space, error)
	Create(ctx context.Context, space *model.Space) error
	List(ctx context.Context) ([]*model.Space, error)
}

SpaceRepo is the interface that provides space methods.

type UserRepo

type UserRepo interface {
	List(ctx context.Context, offset, limit int64) ([]*model.User, error)
	Create(ctx context.Context, user *model.User) error
	GetByID(ctx context.Context, id int64) (*model.User, error)
	GetByEmail(ctx context.Context, email string) (*model.User, error)
	Ban(ctx context.Context, id int64) error
	UpdatePubKey(ctx context.Context, id int64, pubKey string) error
	GrantCert(ctx context.Context, cert *model.UserCert) error
	UpdateCert(ctx context.Context, id int64, cert string) error
	RevokeCert(ctx context.Context, id int64) error
	RevokeAllCerts(ctx context.Context, userID int64) error
	ListCerts(ctx context.Context, userID int64) ([]*model.UserCert, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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