Documentation
¶
Overview ¶
Package model groups a lot of types that model the data that drives Coduno.
It is designed for Google Datastore, but switching to other BigTable implementations is not inconceivable (though it might require some more work).
Not all exported types directly translate to entities that are persisted, but most of them do.
Index ¶
- Constants
- func NewQueryForChallenge() *datastore.Query
- func NewQueryForCoderJunitTestResult() *datastore.Query
- func NewQueryForCompany() *datastore.Query
- func NewQueryForDiffTestResult() *datastore.Query
- func NewQueryForInvitation() *datastore.Query
- func NewQueryForJunitTestResult() *datastore.Query
- func NewQueryForProfile() *datastore.Query
- func NewQueryForResult() *datastore.Query
- func NewQueryForRobotTestResults() *datastore.Query
- func NewQueryForSubmission() *datastore.Query
- func NewQueryForTask() *datastore.Query
- func NewQueryForTemplate() *datastore.Query
- func NewQueryForTest() *datastore.Query
- func NewQueryForToken() *datastore.Query
- func NewQueryForUser() *datastore.Query
- type Assignment
- type Challenge
- type Challenges
- type CoderJunitTestResult
- type CoderJunitTestResults
- type Company
- type Companys
- type DiffTestResult
- type DiffTestResults
- type Endpoints
- type Failure
- type Invitation
- type Invitations
- type JunitTestResult
- type JunitTestResults
- type KeyedChallenge
- type KeyedCoderJunitTestResult
- type KeyedCompany
- type KeyedDiffTestResult
- type KeyedInvitation
- type KeyedJunitTestResult
- type KeyedProfile
- type KeyedResult
- type KeyedRobotTestResults
- type KeyedSubmission
- type KeyedTask
- type KeyedTemplate
- type KeyedTest
- type KeyedToken
- type KeyedUser
- type Map
- type Position
- type Profile
- type Profiles
- type Result
- type Results
- type RobotDirection
- type RobotEvent
- type RobotLogEntry
- type RobotTestResults
- type RobotTestResultss
- type Rusage
- type SimpleTestResult
- type SkillWeights
- type Skills
- type StoredObject
- type Submission
- type Submissions
- type Task
- func (ƨ *Task) Key(key *datastore.Key) *KeyedTask
- func (t *Task) Load(ps []datastore.Property) error
- func (ƨ Task) Put(ctx context.Context, key *datastore.Key) (*datastore.Key, error)
- func (ƨ Task) PutWithParent(ctx context.Context, parent *datastore.Key) (*datastore.Key, error)
- func (t *Task) Save() ([]datastore.Property, error)
- type Tasks
- type Template
- type Templates
- type Test
- func (ƨ *Test) Key(key *datastore.Key) *KeyedTest
- func (t *Test) Load(ps []datastore.Property) error
- func (ƨ Test) Put(ctx context.Context, key *datastore.Key) (*datastore.Key, error)
- func (ƨ Test) PutWithParent(ctx context.Context, parent *datastore.Key) (*datastore.Key, error)
- func (t *Test) Save() ([]datastore.Property, error)
- type TestCase
- type TestResult
- type TestStats
- type Tests
- type Token
- type Tokens
- type UnitTestResults
- type User
- type Users
Constants ¶
const ( Move RobotEvent = RobotEvent("MOVE") OutOfBounds = RobotEvent("OUT_OF_BOUNDS") Obstacle = RobotEvent("HIT_OBSTACLE") MissedCoin = RobotEvent("MISSED_COIN") WrongPick = RobotEvent("WRONG_PICK") Picked = RobotEvent("PICKED") )
const ChallengeKind = "Challenge"
ChallengeKind is the kind used in Datastore to store entities Challenge entities.
const CoderJunitTestResultKind = "CoderJunitTestResult"
CoderJunitTestResultKind is the kind used in Datastore to store entities CoderJunitTestResult entities.
const CompanyKind = "Company"
CompanyKind is the kind used in Datastore to store entities Company entities.
const DiffTestResultKind = "DiffTestResult"
DiffTestResultKind is the kind used in Datastore to store entities DiffTestResult entities.
const InvitationKind = "Invitation"
InvitationKind is the kind used in Datastore to store entities Invitation entities.
const JunitTestResultKind = "JunitTestResult"
JunitTestResultKind is the kind used in Datastore to store entities JunitTestResult entities.
const ProfileKind = "Profile"
ProfileKind is the kind used in Datastore to store entities Profile entities.
const ResultKind = "Result"
ResultKind is the kind used in Datastore to store entities Result entities.
const RobotTestResultsKind = "RobotTestResults"
RobotTestResultsKind is the kind used in Datastore to store entities RobotTestResults entities.
const SubmissionKind = "Submission"
SubmissionKind is the kind used in Datastore to store entities Submission entities.
const TaskKind = "Task"
TaskKind is the kind used in Datastore to store entities Task entities.
const TemplateKind = "Template"
TemplateKind is the kind used in Datastore to store entities Template entities.
const TestKind = "Test"
TestKind is the kind used in Datastore to store entities Test entities.
const TokenKind = "Token"
TokenKind is the kind used in Datastore to store entities Token entities.
const UserKind = "User"
UserKind is the kind used in Datastore to store entities User entities.
Variables ¶
This section is empty.
Functions ¶
func NewQueryForChallenge ¶
NewQueryForChallenge prepares a datastore.Query that can be used to query entities of type Challenge.
func NewQueryForCoderJunitTestResult ¶
NewQueryForCoderJunitTestResult prepares a datastore.Query that can be used to query entities of type CoderJunitTestResult.
func NewQueryForCompany ¶
NewQueryForCompany prepares a datastore.Query that can be used to query entities of type Company.
func NewQueryForDiffTestResult ¶
NewQueryForDiffTestResult prepares a datastore.Query that can be used to query entities of type DiffTestResult.
func NewQueryForInvitation ¶
NewQueryForInvitation prepares a datastore.Query that can be used to query entities of type Invitation.
func NewQueryForJunitTestResult ¶
NewQueryForJunitTestResult prepares a datastore.Query that can be used to query entities of type JunitTestResult.
func NewQueryForProfile ¶
NewQueryForProfile prepares a datastore.Query that can be used to query entities of type Profile.
func NewQueryForResult ¶
NewQueryForResult prepares a datastore.Query that can be used to query entities of type Result.
func NewQueryForRobotTestResults ¶
NewQueryForRobotTestResults prepares a datastore.Query that can be used to query entities of type RobotTestResults.
func NewQueryForSubmission ¶
NewQueryForSubmission prepares a datastore.Query that can be used to query entities of type Submission.
func NewQueryForTask ¶
NewQueryForTask prepares a datastore.Query that can be used to query entities of type Task.
func NewQueryForTemplate ¶
NewQueryForTemplate prepares a datastore.Query that can be used to query entities of type Template.
func NewQueryForTest ¶
NewQueryForTest prepares a datastore.Query that can be used to query entities of type Test.
func NewQueryForToken ¶
NewQueryForToken prepares a datastore.Query that can be used to query entities of type Token.
func NewQueryForUser ¶
NewQueryForUser prepares a datastore.Query that can be used to query entities of type User.
Types ¶
type Assignment ¶
type Assignment struct { // Name should give a very brief and memorable // description and classification of the assignment. Name string `datastore:",index",json:",omitempty"` // Description should detail what this assignment is // about and why it makes sense. // // TODO(victorbalan): Improve documentation. Description string `datastore:",noindex",json:",omitempty"` // Instructions should make clear how the assignment // is to be carried out (e.g. a step-by-step guide). // // NOTE(flowlo, victorbalan): Instructions is not guaranteed // to be backwards-compatible. In the future it may // be an URL pointing at the source of the instructions. Instructions string `datastore:",noindex",json:",omitempty"` // Expected time to complete the assignment. Can serve // as deadline. Duration time.Duration `datastore:",index",json:",omitempty"` // Where to deliver results as part of carrying out the // assignment. Endpoints Endpoints `datastore:",noindex",json:",omitempty"` }
Assignment conveys the specification of what a User must do in order to fulfill a Task or Challenge.
type Challenge ¶
type Challenge struct { Assignment // The tasks that have to be fulfilled in order // to successfully complete the Challenge. // // Result.StartTimes and Result.FinalSubmissions // depend on the ordering of this slice. Also it // affects the rendering of this Challenge with // respect to the user. Therefore it must be // guaranteed to be stable. Tasks []*datastore.Key `datastore:",noindex",json:",omitempty"` // The Resulter to use to compute skills (and // therefore a Result) from the outcome of // the Submissions to Tasks. Resulter int64 `datastore:",noindex",json:",omitempty"` }
Challenge is an abstract piece of work that can consist of many different Tasks.
Saved in Datastore, Challenge will be a child entity to Company, so keys pointing to a Challenge can be used to obtain the Company that owns it.
func (*Challenge) Key ¶
func (ƨ *Challenge) Key(key *datastore.Key) *KeyedChallenge
Key is a shorthand to fill a KeyedChallenge with an entity and it's key.
type Challenges ¶
type Challenges []Challenge
Challenges is just a slice of Challenge.
func (Challenges) Key ¶
func (ƨ Challenges) Key(keys []*datastore.Key) (keyed []KeyedChallenge)
Key is a shorthand to fill a slice of KeyedChallenge with some entities alongside their keys.
type CoderJunitTestResult ¶
type CoderJunitTestResult struct { JunitTestResult ShouldFail bool }
CoderJunitTestResult is the result of a set of JUnit tests written by the coder for some specs ran against code written by the coduno team for said specs. Besides the results of the test, it also encapsulates wether it was supposed to fail in order to assess the correctness of the unit tests.
func (*CoderJunitTestResult) Key ¶
func (ƨ *CoderJunitTestResult) Key(key *datastore.Key) *KeyedCoderJunitTestResult
Key is a shorthand to fill a KeyedCoderJunitTestResult with an entity and it's key.
func (CoderJunitTestResult) Put ¶
Put will put this CoderJunitTestResult into Datastore using the given key.
func (CoderJunitTestResult) PutWithParent ¶
func (ƨ CoderJunitTestResult) PutWithParent(ctx context.Context, parent *datastore.Key) (*datastore.Key, error)
PutWithParent can be used to save this CoderJunitTestResult as child of another entity. This will error if parent == nil.
type CoderJunitTestResults ¶
type CoderJunitTestResults []CoderJunitTestResult
CoderJunitTestResults is just a slice of CoderJunitTestResult.
func (CoderJunitTestResults) Key ¶
func (ƨ CoderJunitTestResults) Key(keys []*datastore.Key) (keyed []KeyedCoderJunitTestResult)
Key is a shorthand to fill a slice of KeyedCoderJunitTestResult with some entities alongside their keys.
type Company ¶
type Company struct { mail.Address `datastore:",index",json:",omitempty"` // Unique name for this user, like analogous to @google // on GitHub/Twitter/... Nick string `datastore:",index",json:",omitempty"` }
Company contains the data related to a company.
TODO(flowlo, victorbalan): In the future, the company may point at Users to enable role based authentication.
func (*Company) Key ¶
func (ƨ *Company) Key(key *datastore.Key) *KeyedCompany
Key is a shorthand to fill a KeyedCompany with an entity and it's key.
type DiffTestResult ¶
type DiffTestResult struct { SimpleTestResult DiffLines []int `datastore:",noindex"` Endpoint string Failed bool }
DiffTestResult holds the result of an outputtest.
func (*DiffTestResult) Key ¶
func (ƨ *DiffTestResult) Key(key *datastore.Key) *KeyedDiffTestResult
Key is a shorthand to fill a KeyedDiffTestResult with an entity and it's key.
func (DiffTestResult) PutWithParent ¶
func (ƨ DiffTestResult) PutWithParent(ctx context.Context, parent *datastore.Key) (*datastore.Key, error)
PutWithParent can be used to save this DiffTestResult as child of another entity. This will error if parent == nil.
type DiffTestResults ¶
type DiffTestResults []DiffTestResult
DiffTestResults is just a slice of DiffTestResult.
func (DiffTestResults) Key ¶
func (ƨ DiffTestResults) Key(keys []*datastore.Key) (keyed []KeyedDiffTestResult)
Key is a shorthand to fill a slice of KeyedDiffTestResult with some entities alongside their keys.
type Endpoints ¶
type Endpoints struct { // Name of the WebComponent used to render // the assignment accordingly. WebInterface string `datastore:",noindex",json:",omitempty"` // URL of the remote that should be pushed // to. // // NOTE(flowlo): No backwards-compatibility // guarantee on this. // // TODO(flowlo): Investigate why we can not use // url.URL GitRepository string `datastore:",noindex",json:",omitempty"` }
Endpoints encapsulates two possible ways to deliver the outcome of trying to fulfill an assignment.
type Failure ¶
type Failure struct {
Message string `xml:"message,attr"`
}
Failure holds a failure created by JUnit.
type Invitation ¶
type Invitation struct { User *datastore.Key `datastore:",index",json:",omitempty"` Sent time.Time `datastore:",index",json:",omitempty"` }
Invitation represents the message sent by a company to a User in order to ask them to do a Challenge.
func (*Invitation) Key ¶
func (ƨ *Invitation) Key(key *datastore.Key) *KeyedInvitation
Key is a shorthand to fill a KeyedInvitation with an entity and it's key.
func (Invitation) PutWithParent ¶
func (ƨ Invitation) PutWithParent(ctx context.Context, parent *datastore.Key) (*datastore.Key, error)
PutWithParent can be used to save this Invitation as child of another entity. This will error if parent == nil.
type Invitations ¶
type Invitations []Invitation
Invitations is just a slice of Invitation.
func (Invitations) Key ¶
func (ƨ Invitations) Key(keys []*datastore.Key) (keyed []KeyedInvitation)
Key is a shorthand to fill a slice of KeyedInvitation with some entities alongside their keys.
type JunitTestResult ¶
type JunitTestResult struct { Stdout string `datastore:",noindex"` Stderr string `datastore:",noindex"` Exit string `datastore:",noindex"` Start time.Time `datastore:",index"` End time.Time `datastore:",index"` Results UnitTestResults `datastore:",noindex"` Endpoint string }
JunitTestResult is a submission to a set of JUnit test cases. Besides the uploaded code, it also encapsulates more detailed results generated by JUnit.
func (*JunitTestResult) Key ¶
func (ƨ *JunitTestResult) Key(key *datastore.Key) *KeyedJunitTestResult
Key is a shorthand to fill a KeyedJunitTestResult with an entity and it's key.
func (JunitTestResult) PutWithParent ¶
func (ƨ JunitTestResult) PutWithParent(ctx context.Context, parent *datastore.Key) (*datastore.Key, error)
PutWithParent can be used to save this JunitTestResult as child of another entity. This will error if parent == nil.
type JunitTestResults ¶
type JunitTestResults []JunitTestResult
JunitTestResults is just a slice of JunitTestResult.
func (JunitTestResults) Key ¶
func (ƨ JunitTestResults) Key(keys []*datastore.Key) (keyed []KeyedJunitTestResult)
Key is a shorthand to fill a slice of KeyedJunitTestResult with some entities alongside their keys.
type KeyedChallenge ¶
KeyedChallenge is a struct that embeds Challenge and also contains a Key, mainly used for encoding to JSON.
type KeyedCoderJunitTestResult ¶
type KeyedCoderJunitTestResult struct { *CoderJunitTestResult Key *datastore.Key }
KeyedCoderJunitTestResult is a struct that embeds CoderJunitTestResult and also contains a Key, mainly used for encoding to JSON.
type KeyedCompany ¶
KeyedCompany is a struct that embeds Company and also contains a Key, mainly used for encoding to JSON.
type KeyedDiffTestResult ¶
type KeyedDiffTestResult struct { *DiffTestResult Key *datastore.Key }
KeyedDiffTestResult is a struct that embeds DiffTestResult and also contains a Key, mainly used for encoding to JSON.
type KeyedInvitation ¶
type KeyedInvitation struct { *Invitation Key *datastore.Key }
KeyedInvitation is a struct that embeds Invitation and also contains a Key, mainly used for encoding to JSON.
type KeyedJunitTestResult ¶
type KeyedJunitTestResult struct { *JunitTestResult Key *datastore.Key }
KeyedJunitTestResult is a struct that embeds JunitTestResult and also contains a Key, mainly used for encoding to JSON.
type KeyedProfile ¶
KeyedProfile is a struct that embeds Profile and also contains a Key, mainly used for encoding to JSON.
type KeyedResult ¶
KeyedResult is a struct that embeds Result and also contains a Key, mainly used for encoding to JSON.
type KeyedRobotTestResults ¶
type KeyedRobotTestResults struct { *RobotTestResults Key *datastore.Key }
KeyedRobotTestResults is a struct that embeds RobotTestResults and also contains a Key, mainly used for encoding to JSON.
type KeyedSubmission ¶
type KeyedSubmission struct { *Submission Key *datastore.Key }
KeyedSubmission is a struct that embeds Submission and also contains a Key, mainly used for encoding to JSON.
type KeyedTask ¶
KeyedTask is a struct that embeds Task and also contains a Key, mainly used for encoding to JSON.
type KeyedTemplate ¶
KeyedTemplate is a struct that embeds Template and also contains a Key, mainly used for encoding to JSON.
type KeyedTest ¶
KeyedTest is a struct that embeds Test and also contains a Key, mainly used for encoding to JSON.
type KeyedToken ¶
KeyedToken is a struct that embeds Token and also contains a Key, mainly used for encoding to JSON.
type KeyedUser ¶
KeyedUser is a struct that embeds User and also contains a Key, mainly used for encoding to JSON.
type Profile ¶
type Profile struct { Skills `datastore:",index",json:",omitempty"` LastUpdate time.Time `datastore:",index",json:",omitempty"` }
Profile is the current rating of a User. It can vary over times as new Results come in and will be recomputed as needed. It is there to give a quick overview over the skills/performance of an individual user.
For short-timed challenges, the Profile should not be updated, but only when a final result was produced.
Long-term challenges may decide to refresh the competing user's Profile as pleased, but should not do so more than once a day.
Saved in Datastore, Profile will be a child entity to User, so keys pointing to a Profile can be used to obtain the user they represent.
func (*Profile) Key ¶
func (ƨ *Profile) Key(key *datastore.Key) *KeyedProfile
Key is a shorthand to fill a KeyedProfile with an entity and it's key.
type Result ¶
type Result struct { // Calculated by logic from the Challenge. If // it is missing an average over all FinalSubmissions // will be computed at best effort. Skills Skills `datastore:",index",json:",omitempty"` // Challenge refers to the challenge that this // result provides data for. Challenge *datastore.Key `datastore:",index",json:",omitempty"` // Indicates when the user has started to work on // a Task (meaning as soon as the Task // is served to the user). // // In case all Tasks are available to the // user in parallel, it is possible that every // element of this slice holds the same value. // Anyway, the Challenge logic has to make sense // of this property and how to interpret it. // // Indexed the same as Challenge.Tasks. StartTimes []time.Time `datastore:",noindex",json:",omitempty"` // Points to the last submission to the // corresponding Task. // // Indexed the same as Challenge.Tasks. FinalSubmissions []*datastore.Key `datastore:",noindex",json:",omitempty"` // The time when the coder started the Challenge. Started time.Time `datastore:",index",json:",omitempty"` // The time when the coder finished the Challenge. Finished time.Time `datastore:",index",json:",omitempty"` // When this result was last (re)computed by the // Resulter in Challenge. Computed time.Time `datastore:",index",json:",omitempty"` }
Result holds the performance of an User for some Challenge. It is fixed once the user has completed the Challenge or timed out. After that, only Skills are to be modified in case the logic in Challenge changes.
Saved in Datastore, Result will be a child entity to Profile, so keys pointing to a Result can be used to obtain the Profile they influence.
func (*Result) Key ¶
func (ƨ *Result) Key(key *datastore.Key) *KeyedResult
Key is a shorthand to fill a KeyedResult with an entity and it's key.
type RobotEvent ¶
type RobotEvent string
type RobotLogEntry ¶
type RobotLogEntry struct { Position Event RobotEvent }
func (RobotLogEntry) Move ¶
func (p RobotLogEntry) Move(d RobotDirection) RobotLogEntry
func (*RobotLogEntry) Validate ¶
func (p *RobotLogEntry) Validate(m *Map) bool
type RobotTestResults ¶
type RobotTestResults struct { Failed bool ReachedFinish bool Moves []RobotLogEntry }
func (*RobotTestResults) Key ¶
func (ƨ *RobotTestResults) Key(key *datastore.Key) *KeyedRobotTestResults
Key is a shorthand to fill a KeyedRobotTestResults with an entity and it's key.
func (RobotTestResults) Put ¶
Put will put this RobotTestResults into Datastore using the given key.
func (RobotTestResults) PutWithParent ¶
func (ƨ RobotTestResults) PutWithParent(ctx context.Context, parent *datastore.Key) (*datastore.Key, error)
PutWithParent can be used to save this RobotTestResults as child of another entity. This will error if parent == nil.
type RobotTestResultss ¶
type RobotTestResultss []RobotTestResults
RobotTestResultss is just a slice of RobotTestResults.
func (RobotTestResultss) Key ¶
func (ƨ RobotTestResultss) Key(keys []*datastore.Key) (keyed []KeyedRobotTestResults)
Key is a shorthand to fill a slice of KeyedRobotTestResults with some entities alongside their keys.
type Rusage ¶
type Rusage struct { Utime, Stime syscall.Timeval Maxrss, Ixrss, Idrss, Isrss, Minflt, Majflt, Nswap, Inblock, Oublock, Msgsnd, Msgrcv, Nsignals, Nvcsw, Nivcsw int64 `json:",omitempty"` }
Rusage is is a copy of syscall.Rusage for Linux. It is needed as syscall.Rusage built on Windows cannot be saved in Datastore because it holds unsigned integers. Runs are executed inside Docker and therefore will always generate this version of syscall.Rusage. See https://godoc.org/google.golang.org/cloud/datastore#Property See https://golang.org/src/syscall/syscall_windows.go See https://golang.org/src/syscall/ztypes_linux_amd64.go
type SimpleTestResult ¶
type SimpleTestResult struct { Stdout string `datastore:",noindex",json:",omitempty"` Stderr string `datastore:",noindex",json:",omitempty"` Exit string `datastore:",noindex",json:",omitempty"` Prepare string `datastore:",noindex",json:",omitempty"` Rusage Rusage `datastore:",noindex",json:",omitempty"` Start time.Time `datastore:",index",json:",omitempty"` End time.Time `datastore:",index",json:",omitempty"` }
type SkillWeights ¶
type SkillWeights Skills
SkillWeights can be used to express what impact or rating a Task has on a set of Skills.
type Skills ¶
type Skills struct { Readability, Security, CodingSpeed, Algorithmics float64 `json:",omitempty"` }
Skills we assess.
TODO(flowlo, victorbalan): Add further categories of assessment.
type StoredObject ¶
type StoredObject struct { // The bucket the object resides in. Bucket string // Name of the object inside the bucket. Name string }
StoredObject refers to an object stored in Google Cloud Storage.
See https://cloud.google.com/storage/docs/concepts-techniques#concepts
type Submission ¶
Submission is a form of result for some Task.
TODO(flowlo): As soon as we also store other submissions, implement a PropertyLoadSaver similar to this:
func (s *Submission) Load(ps []datastore.Property) error { return datastore.LoadStruct(s, ps) } func (s *Submission) Save() ([]datastore.Property, error) { if s.Code.Name != "" && s.Answers != nil { return nil, errors.New("cannot save Code and Answers in one Submission") } return ... }
func (*Submission) Key ¶
func (ƨ *Submission) Key(key *datastore.Key) *KeyedSubmission
Key is a shorthand to fill a KeyedSubmission with an entity and it's key.
func (Submission) PutWithParent ¶
func (ƨ Submission) PutWithParent(ctx context.Context, parent *datastore.Key) (*datastore.Key, error)
PutWithParent can be used to save this Submission as child of another entity. This will error if parent == nil.
type Submissions ¶
type Submissions []Submission
Submissions is just a slice of Submission.
func (Submissions) Key ¶
func (ƨ Submissions) Key(keys []*datastore.Key) (keyed []KeyedSubmission)
Key is a shorthand to fill a slice of KeyedSubmission with some entities alongside their keys.
type Task ¶
type Task struct { // Returns details on the assignment that is covered by this task. Assignment Assignment // Says what skills are needed/exercised to complete // the Task. SkillWeights SkillWeights // Refers to some logic that looks at the Submissions // of this task and produces a set of skills that // represent how well the user did in doing this Task. // It is to be weighted by SkillWeights. Tasker int64 `json:"-"` Templates map[string][]StoredObject `json:"-"` Languages []string `json:",omitempty"` }
Task is a concrete piece of work that cannot be split any further.
This type is very general and can be implemented in vrious ways, accordingly implementing logic to make this Task comparable to others with respect to it's SkillWeights.
func (Task) PutWithParent ¶
PutWithParent can be used to save this Task as child of another entity. This will error if parent == nil.
type Template ¶
type Template struct { Language string `datastore:",index"` Path string `datastore:",noindex"` Challenge *datastore.Key `datastore:",index"` }
Template contains data about a code template assigned to a Task
func (*Template) Key ¶
func (ƨ *Template) Key(key *datastore.Key) *KeyedTemplate
Key is a shorthand to fill a KeyedTemplate with an entity and it's key.
type Test ¶
func (Test) PutWithParent ¶
PutWithParent can be used to save this Test as child of another entity. This will error if parent == nil.
type TestCase ¶
type TestCase struct { Name string `xml:"name,attr"` Duration time.Duration `xml:"time,attr"` Failure Failure `xml:"failure"` }
TestCase holds a test case created by JUnit.
type TestResult ¶
type TestResult struct{}
type Token ¶
type Token struct { // Corresponds to the crypto.Hash that was used to hash the value // of this Token. // It is an int and not a crypto.Hash because the base type of // crypto.Hash is uint (go1) and unsigned types cannot be stored by // Datastore. // A conversion is needed at runtime: // // hash := crypto.Hash(Token.Hash) // Hash int `datastore:",noindex",json:",omitempty"` // The digest of this Token after hashing with above hash. Digest []byte `datastore:",noindex",json:",omitempty"` // If a User is authenticated using an Token, authorization // can be granted to only a subset of possible actions. This slice // acts as a filter and should list allowed scopes, i.e. permissions. Scopes []string `datastore:",noindex",json:",omitempty"` // Arbitrary string describing the use of this token. It can be // automatically generated or set by the user. Description string `datastore:",noindex",json:",omitempty"` // Time of creation. Creation time.Time `datastore:",noindex",json:",omitempty"` // If an Token is seen after Expiry, it is to be deleted. This property // is indexed to enable for grabage collection of expired Tokens. Expiry time.Time `datastore:",index",json:",omitempty"` // Address of the client that created this Token. RemoteAddr string `datastore:",noindex",json:",omitempty"` }
Token encapsulates a digest of a secret that can be used to authenticate a User. The entity only holds a digest to prevent impersonation of a user in case it is leaked.
When requests arrive, the correct Token is queried by key, therefore these entities use indexes vary sparingly.
Tokens reside in an entity group rooted at a User. As Tokens cannot be altered by the user, writes are only done at creation and deletion and are therefore neglegible.
func (*Token) Key ¶
func (ƨ *Token) Key(key *datastore.Key) *KeyedToken
Key is a shorthand to fill a KeyedToken with an entity and it's key.
type UnitTestResults ¶
type UnitTestResults struct { Tests int `xml:"tests,attr"` Failures int `xml:"failures,attr"` Errors int `xml:"errors,attr"` TestCase []TestCase `xml:"testcase"` }
UnitTestResults holds the unit test result created by JUnit.
type User ¶
type User struct { // Encapsulates Name (combined first and last name, // however the user likes) and an e-mail address. // // Datastore will split this into two properties // called Name and Address, where Address must be // guaranteed to be unique. mail.Address `datastore:",index",json:",omitempty"` // Unique name for this user, like analogous to @flowlo // on GitHub/Twitter/... Nick string `datastore:",index",json:",omitempty"` // Points to the company a user works for, if any. Company *datastore.Key `datastore:",index",json:",omitempty"` // Hashed and salted password to be accessed by // corresponding helpers in util. // See https://godoc.org/golang.org/x/crypto/bcrypt HashedPassword []byte `datastore:",noindex" json:"-"` }
User is anybody interacting with our systems. It will ultimately refer to who accessed Coduno (or on whose behalf).
Source Files
¶
- assignment.go
- challenge.go
- challenge_impl.go
- coder_junit_result.go
- coder_junit_result_impl.go
- company.go
- company_impl.go
- diff_test_result.go
- diff_test_result_impl.go
- endpoints.go
- invitation.go
- invitation_impl.go
- junit_test_result.go
- junit_test_result_impl.go
- model.go
- profile.go
- profile_impl.go
- result.go
- result_impl.go
- robot_test_results.go
- robot_test_results_impl.go
- rusage.go
- simple_test_result.go
- skills.go
- stored_object.go
- submission.go
- submission_impl.go
- task.go
- task_impl.go
- template.go
- template_impl.go
- test.go
- test_impl.go
- test_result.go
- test_stats.go
- token.go
- token_impl.go
- user.go
- user_impl.go