Documentation ¶
Index ¶
- Constants
- Variables
- func MakeLocalManager(dbPath string, worldState common.WorldState) (*localManager, error)
- type APIRouter
- type AuthorisationInfo
- type MaybeInt32
- type MaybeInt64
- type StatusResponse
- type StatusUpdate
- type UserInfo
- type UserManager
- type Voidmanager
- func (v *Voidmanager) AuthenticateUser(bytes []byte) (int64, int64, error)
- func (v *Voidmanager) AuthoriseNewSession(bytes []byte, info AuthorisationInfo) error
- func (v *Voidmanager) DeleteUser(UID []byte) error
- func (v *Voidmanager) GetUserInfo(UID []byte) (UserInfo, error)
- func (v *Voidmanager) ListAllUsers() ([]UserInfo, error)
- func (v *Voidmanager) UploadStatus(updates []StatusUpdate) ([]StatusResponse, error)
- func (v *Voidmanager) WriteUserInfo(info UserInfo) error
Constants ¶
View Source
const (
TERMINATE = iota + 1
)
Variables ¶
View Source
var ErrMangerIsVoid = errors.New("cannot perform operation with user manager as database path is not specified")
View Source
var ErrNoDownCredit = errors.New("No download credit left")
View Source
var ErrNoUpCredit = errors.New("No upload credit left")
View Source
var ErrSessionsCapReached = errors.New("Sessions cap has reached")
View Source
var ErrUserExpired = errors.New("User has expired")
View Source
var ErrUserNotFound = errors.New("UID does not correspond to a user")
Functions ¶
func MakeLocalManager ¶
func MakeLocalManager(dbPath string, worldState common.WorldState) (*localManager, error)
Types ¶
type APIRouter ¶
func APIRouterOf ¶
func APIRouterOf(manager UserManager) *APIRouter
type AuthorisationInfo ¶
type AuthorisationInfo struct {
NumExistingSessions int
}
type StatusResponse ¶
type StatusUpdate ¶
type UserInfo ¶
type UserInfo struct { UID []byte SessionsCap MaybeInt32 UpRate MaybeInt64 DownRate MaybeInt64 UpCredit MaybeInt64 DownCredit MaybeInt64 ExpiryTime MaybeInt64 }
type UserManager ¶
type UserManager interface { AuthenticateUser([]byte) (int64, int64, error) AuthoriseNewSession([]byte, AuthorisationInfo) error UploadStatus([]StatusUpdate) ([]StatusResponse, error) ListAllUsers() ([]UserInfo, error) GetUserInfo(UID []byte) (UserInfo, error) WriteUserInfo(UserInfo) error DeleteUser(UID []byte) error }
type Voidmanager ¶
type Voidmanager struct{}
func (*Voidmanager) AuthenticateUser ¶
func (v *Voidmanager) AuthenticateUser(bytes []byte) (int64, int64, error)
func (*Voidmanager) AuthoriseNewSession ¶
func (v *Voidmanager) AuthoriseNewSession(bytes []byte, info AuthorisationInfo) error
func (*Voidmanager) DeleteUser ¶
func (v *Voidmanager) DeleteUser(UID []byte) error
func (*Voidmanager) GetUserInfo ¶
func (v *Voidmanager) GetUserInfo(UID []byte) (UserInfo, error)
func (*Voidmanager) ListAllUsers ¶
func (v *Voidmanager) ListAllUsers() ([]UserInfo, error)
func (*Voidmanager) UploadStatus ¶
func (v *Voidmanager) UploadStatus(updates []StatusUpdate) ([]StatusResponse, error)
func (*Voidmanager) WriteUserInfo ¶
func (v *Voidmanager) WriteUserInfo(info UserInfo) error
Click to show internal directories.
Click to hide internal directories.