Documentation ¶
Index ¶
- Constants
- Variables
- type Action
- type DatabaseClient
- type DatabaseClientImpl
- func (d DatabaseClientImpl) CreateJob(ctx context.Context, entry *Job) (primitive.ObjectID, error)
- func (d DatabaseClientImpl) GetJob(ctx context.Context, id string) (*Job, error)
- func (d DatabaseClientImpl) GetMatchInfo(ctx context.Context, id string) (*MatchInfo, error)
- func (d DatabaseClientImpl) List(ctx context.Context, filter interface{}) ([]*Job, error)
- func (d DatabaseClientImpl) UpdateJob(ctx context.Context, entry *Job) (primitive.ObjectID, error)
- func (d DatabaseClientImpl) UpsertMatchInfo(ctx context.Context, entry *MatchInfo) error
- type Job
- type JobStatus
- type MatchInfo
- type ServerStatus
Constants ¶
View Source
const ( CollectionName = "pterodactyl_matchinfo" DatabaseName = "unwindia" DefaultTimeout = 10 * time.Second )
Variables ¶
View Source
var ActionName = map[int]string{
0: "create",
1: "delete",
}
View Source
var ActionValue = map[string]Action{ JobStatusName[0]: ActionCreate, JobStatusName[1]: ActionDelete, }
View Source
var JobStatusName = map[int]string{
0: "new",
1: "inProgress",
2: "finished",
3: "error",
}
View Source
var JobStatusValue = map[string]JobStatus{ JobStatusName[0]: JobStatusNew, JobStatusName[1]: JobStatusInProgress, JobStatusName[2]: JobStatusFinished, JobStatusName[3]: JobStatusError, }
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action int
func (*Action) UnmarshalJSON ¶
UnmarshalJSON unmarshals b into MessageTypes.
type DatabaseClient ¶
type DatabaseClient interface { // UpsertJob creates or updates an DotlanForumStatus entry CreateJob(ctx context.Context, entry *Job) (primitive.ObjectID, error) UpdateJob(ctx context.Context, entry *Job) (primitive.ObjectID, error) UpsertMatchInfo(ctx context.Context, entry *MatchInfo) error // Get returns an existing DotlanForumStatus by the given id. Id is the id of the match within dotlan (tcontest.tcid) GetJob(ctx context.Context, id string) (*Job, error) // List returns all existing DotlanForumStatus entries in a Result chan //List(ctx context.Context, filter interface{}, resultChan chan Result) List(ctx context.Context, filter interface{}) ([]*Job, error) GetMatchInfo(ctx context.Context, id string) (*MatchInfo, error) }
DatabaseClient is the client-interface for the main mongodb database
type DatabaseClientImpl ¶
type DatabaseClientImpl struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(ctx context.Context, env *environment.Environment) (*DatabaseClientImpl, error)
func (DatabaseClientImpl) GetMatchInfo ¶
func (DatabaseClientImpl) List ¶
func (d DatabaseClientImpl) List(ctx context.Context, filter interface{}) ([]*Job, error)
func (d DatabaseClientImpl) List(ctx context.Context, filter interface{}, resultChan chan Result) {
func (DatabaseClientImpl) UpsertMatchInfo ¶
func (d DatabaseClientImpl) UpsertMatchInfo(ctx context.Context, entry *MatchInfo) error
type Job ¶
type Job struct { mgm.DefaultModel `bson:",inline"` Action Action Status JobStatus MatchId string Game string Slots int ServerId int ExecAfter *time.Time `bson:"execAfter,omitempty"` MatchInfo matchservice.MatchInfo }
func (*Job) CollectionName ¶
type JobStatus ¶
type JobStatus int
func (*JobStatus) UnmarshalJSON ¶
UnmarshalJSON unmarshals b into MessageTypes.
type MatchInfo ¶
type MatchInfo struct { Id string `bson:"_id" json:"id"` MatchInfo matchservice.MatchInfo `bson:"matchInfo,omitempty"` JobIds []primitive.ObjectID `json:"jobId" bson:"jobIds,omitempty"` CreatedAt time.Time `bson:"createdAt,omitempty"` UpdatedAt time.Time `bson:"updatedAt,omitempty"` }
func (*MatchInfo) CollectionName ¶
type ServerStatus ¶
type ServerStatus struct { mgm.DefaultModel `bson:",inline"` MatchId string `json:"matchId" bson:"matchId,omitempty"` ServerId string `json:"serverId" bson:"serverId,omitempty"` ServerName string ServerIp string ServerPort int ServerPassword string ServerMgmtPassword string }
func (*ServerStatus) CollectionName ¶
func (*ServerStatus) CollectionName() string
Click to show internal directories.
Click to hide internal directories.