datasvc

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: MPL-2.0-no-copyleft-exception Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeDataServer

func MakeDataServer() (*handler.H, chan struct{}, error)

MakeDataServer makes an instance of the datasvc on port 6000. It returns a chan which can be closed to terminate it, and any boot-time errors.

Types

type DataServer

type DataServer struct {
	H *handler.H
}

DataServer is the handle into the GRPC subsystem for the datasvc.

func (*DataServer) AddCapability

func (ds *DataServer) AddCapability(ctx context.Context, cr *data.CapabilityRequest) (*empty.Empty, error)

AddCapability adds a capability for a user.

func (*DataServer) AddError

func (ds *DataServer) AddError(ctx context.Context, ue *types.UserError) (*empty.Empty, error)

AddError adds an error to the user's error stack.

func (*DataServer) AddSubscription

func (ds *DataServer) AddSubscription(ctx context.Context, rus *data.RepoUserSelection) (*empty.Empty, error)

AddSubscription subscribes a repository to a user's account.

func (*DataServer) AllRepositories

func (ds *DataServer) AllRepositories(ctx context.Context, nameSearch *data.NameSearch) (*types.RepositoryList, error)

AllRepositories returns the list of repositories the user can see.

func (*DataServer) CancelRefByName

func (ds *DataServer) CancelRefByName(ctx context.Context, rr *data.RepoRef) (*empty.Empty, error)

CancelRefByName cancels by the ref for all runs related to it. It is looked up by ref and repository information. It is used by the queuesvc to auto cancel runs as new ones are being submitted.

func (*DataServer) CancelSubmission

func (ds *DataServer) CancelSubmission(ctx context.Context, id *types.IntID) (*empty.Empty, error)

CancelSubmission cancels a submission by ID.

func (*DataServer) CancelTask

func (ds *DataServer) CancelTask(ctx context.Context, id *types.IntID) (*empty.Empty, error)

CancelTask cancels a task by ID.

func (*DataServer) CancelTasksByPR

func (ds *DataServer) CancelTasksByPR(ctx context.Context, prq *types.CancelPRRequest) (*empty.Empty, error)

CancelTasksByPR cancels multiple tasks by Pull Request ID.

func (*DataServer) CountRunsForTask

func (ds *DataServer) CountRunsForTask(ctx context.Context, id *types.IntID) (*data.Count, error)

CountRunsForTask counts all the runs for a given task.

func (*DataServer) CountSubmissions

func (ds *DataServer) CountSubmissions(ctx context.Context, req *data.RepositoryFilterRequest) (*data.Count, error)

CountSubmissions returns a count of all submissions that match the filter.

func (*DataServer) CountTasks

func (ds *DataServer) CountTasks(ctx context.Context, req *data.TaskListRequest) (*data.Count, error)

CountTasks counts the number of tasks that would be found by the query

func (*DataServer) DeleteError

func (ds *DataServer) DeleteError(ctx context.Context, ue *types.UserError) (*empty.Empty, error)

DeleteError removes an error from errors list. The error string does not need to be provided.

func (*DataServer) DeleteToken

func (ds *DataServer) DeleteToken(ctx context.Context, name *data.Name) (*empty.Empty, error)

DeleteToken removes the existing token; a new GetToken request will generate a new one.

func (*DataServer) DisableRepository

func (ds *DataServer) DisableRepository(ctx context.Context, rus *data.RepoUserSelection) (*empty.Empty, error)

DisableRepository removes the repository from the CI system. It must already be enabled.

func (*DataServer) EnableRepository

func (ds *DataServer) EnableRepository(ctx context.Context, rus *data.RepoUserSelection) (*empty.Empty, error)

EnableRepository adds the repository to the CI system. It must already exist.

func (*DataServer) GetCancel

func (ds *DataServer) GetCancel(ctx context.Context, id *types.IntID) (*types.Status, error)

GetCancel returns the canceled state for the run.

func (*DataServer) GetCapabilities

func (ds *DataServer) GetCapabilities(ctx context.Context, u *types.User) (*data.Capabilities, error)

GetCapabilities retrieves the capabilities for a user.

func (*DataServer) GetErrors

func (ds *DataServer) GetErrors(ctx context.Context, name *data.Name) (*types.UserErrors, error)

GetErrors retrieves the errors for the provided user.

func (*DataServer) GetRefByNameAndSHA

func (ds *DataServer) GetRefByNameAndSHA(ctx context.Context, rp *data.RefPair) (*types.Ref, error)

GetRefByNameAndSHA retrieves the ref from repository and sha data.

func (*DataServer) GetRepository

func (ds *DataServer) GetRepository(ctx context.Context, name *data.Name) (*types.Repository, error)

GetRepository returns the repository information for the provided name.

func (*DataServer) GetRun

func (ds *DataServer) GetRun(ctx context.Context, id *types.IntID) (*types.Run, error)

GetRun retrieves a run by id.

func (*DataServer) GetRunUI

func (ds *DataServer) GetRunUI(ctx context.Context, id *types.IntID) (*types.Run, error)

GetRunUI retrieves a run by id.

func (*DataServer) GetSubmission

func (ds *DataServer) GetSubmission(ctx context.Context, id *types.IntID) (*types.Submission, error)

GetSubmission returns a submission from the provided ID

func (*DataServer) GetSubmissionRuns

func (ds *DataServer) GetSubmissionRuns(ctx context.Context, sub *data.SubmissionQuery) (*types.RunList, error)

GetSubmissionRuns returns the runs associated with the provided submission.

func (*DataServer) GetSubmissionTasks

func (ds *DataServer) GetSubmissionTasks(ctx context.Context, sub *data.SubmissionQuery) (*types.TaskList, error)

GetSubmissionTasks returns the tasks associated with the provided submission.

func (*DataServer) GetToken

func (ds *DataServer) GetToken(ctx context.Context, name *data.Name) (*types.StringID, error)

GetToken retrieves a token, creating it if necessary, for the user supplied. This token can be presented by the user as a part of the authentication process to login to tinyci and perform operations.

If the token is already set, then this function will return an error and refuse to yield the existing token.

func (*DataServer) HasCapability

func (ds *DataServer) HasCapability(ctx context.Context, cr *data.CapabilityRequest) (*types.Bool, error)

HasCapability returns true if the capability requested exists for the user provided.

func (*DataServer) ListSubmissions

ListSubmissions lists the submissions with optional repository and ref filtering.

func (*DataServer) ListSubscribedTasksForUser

func (ds *DataServer) ListSubscribedTasksForUser(ctx context.Context, lstr *data.ListSubscribedTasksRequest) (*types.TaskList, error)

ListSubscribedTasksForUser mirrors the model call by the same name.

func (*DataServer) ListSubscriptions

func (ds *DataServer) ListSubscriptions(ctx context.Context, nameSearch *data.NameSearch) (*types.RepositoryList, error)

ListSubscriptions lists all subscriptions for a user

func (*DataServer) ListTasks

func (ds *DataServer) ListTasks(ctx context.Context, req *data.TaskListRequest) (*types.TaskList, error)

ListTasks returns a list of tasks based on the query.

func (*DataServer) ListUsers

func (ds *DataServer) ListUsers(ctx context.Context, e *empty.Empty) (*types.UserList, error)

ListUsers returns a list of users registered with the system.

func (*DataServer) LoadSession

func (ds *DataServer) LoadSession(ctx context.Context, id *types.StringID) (*types.Session, error)

LoadSession retrieves a session by ID.

func (*DataServer) OAuthRegisterState

func (ds *DataServer) OAuthRegisterState(ctx context.Context, oas *data.OAuthState) (*empty.Empty, error)

OAuthRegisterState registers the state code with the datasvc; it will be used to validate the other side of the handshake when github redirects back to us.

func (*DataServer) OAuthValidateState

func (ds *DataServer) OAuthValidateState(ctx context.Context, oas *data.OAuthState) (*data.OAuthState, error)

OAuthValidateState registers the state code with the datasvc; it will be used to validate the other side of the handshake when github redirects back to us.

func (*DataServer) OwnedRepositories

func (ds *DataServer) OwnedRepositories(ctx context.Context, nameSearch *data.NameSearch) (*types.RepositoryList, error)

OwnedRepositories returns the list of owned repositories by the user

func (*DataServer) PatchUser

func (ds *DataServer) PatchUser(ctx context.Context, u *types.User) (*empty.Empty, error)

PatchUser loads a user record, overlays the changes and pushes it back to the db.

func (*DataServer) PrivateRepositories

func (ds *DataServer) PrivateRepositories(ctx context.Context, nameSearch *data.NameSearch) (*types.RepositoryList, error)

PrivateRepositories returns the list of private repositories the user can see.

func (*DataServer) PublicRepositories

func (ds *DataServer) PublicRepositories(ctx context.Context, search *data.Search) (*types.RepositoryList, error)

PublicRepositories returns the list of repositories the user can see.

func (*DataServer) PutRef

func (ds *DataServer) PutRef(ctx context.Context, ref *types.Ref) (*types.Ref, error)

PutRef adds a ref to the database.

func (*DataServer) PutSession

func (ds *DataServer) PutSession(ctx context.Context, s *types.Session) (*empty.Empty, error)

PutSession saves a session created for a user.

func (*DataServer) PutStatus

func (ds *DataServer) PutStatus(ctx context.Context, s *types.Status) (*empty.Empty, error)

PutStatus sets the status for the given run_id

func (*DataServer) PutSubmission

func (ds *DataServer) PutSubmission(ctx context.Context, sub *types.Submission) (*types.Submission, error)

PutSubmission registers a submission with the datasvc.

func (*DataServer) PutTask

func (ds *DataServer) PutTask(ctx context.Context, task *types.Task) (*types.Task, error)

PutTask creates a new task for use. Returns the ID of the created task.

func (*DataServer) PutUser

func (ds *DataServer) PutUser(ctx context.Context, u *types.User) (*types.User, error)

PutUser creates a new user.

func (*DataServer) QueueAdd

func (ds *DataServer) QueueAdd(ctx context.Context, list *data.QueueList) (*data.QueueList, error)

QueueAdd adds an item to the queue

func (*DataServer) QueueCount

func (ds *DataServer) QueueCount(ctx context.Context, empty *empty.Empty) (*data.Count, error)

QueueCount is the count of items in the queue

func (*DataServer) QueueCountForRepository

func (ds *DataServer) QueueCountForRepository(ctx context.Context, repo *data.Name) (*data.Count, error)

QueueCountForRepository is the count of items in the queue for the given repository

func (*DataServer) QueueListForRepository

func (ds *DataServer) QueueListForRepository(ctx context.Context, qlr *data.QueueListRequest) (*data.QueueList, error)

QueueListForRepository lists the queue with pagination

func (*DataServer) QueueNext

func (ds *DataServer) QueueNext(ctx context.Context, r *types.QueueRequest) (*types.QueueItem, error)

QueueNext returns the next item for the named queue.

func (*DataServer) RemoveCapability

func (ds *DataServer) RemoveCapability(ctx context.Context, cr *data.CapabilityRequest) (*empty.Empty, error)

RemoveCapability removes a capability from a user.

func (*DataServer) RemoveSubscription

func (ds *DataServer) RemoveSubscription(ctx context.Context, rus *data.RepoUserSelection) (*empty.Empty, error)

RemoveSubscription removes a subscription from the user's subscriptions.

func (*DataServer) RunCount

func (ds *DataServer) RunCount(ctx context.Context, rp *data.RefPair) (*data.Count, error)

RunCount is the count of items in the queue

func (*DataServer) RunList

func (ds *DataServer) RunList(ctx context.Context, rq *data.RunListRequest) (*types.RunList, error)

RunList lists the runs with pagination

func (*DataServer) RunsForTask

func (ds *DataServer) RunsForTask(ctx context.Context, req *data.RunsForTaskRequest) (*types.RunList, error)

RunsForTask retrieves all the runs for the task, with optional pagination.

func (*DataServer) SaveRepositories

func (ds *DataServer) SaveRepositories(ctx context.Context, gh *data.GithubJSON) (*empty.Empty, error)

SaveRepositories saves the provided user's repositories with the username as the owner.

func (*DataServer) SetCancel

func (ds *DataServer) SetCancel(ctx context.Context, id *types.IntID) (*empty.Empty, error)

SetCancel flags the run (which will flag the rest of the task's runs) as canceled. Will fail on finished tasks.

func (*DataServer) UserByName

func (ds *DataServer) UserByName(ctx context.Context, name *data.Name) (*types.User, error)

UserByName retrieves the user by name and returns it.

func (*DataServer) ValidateToken

func (ds *DataServer) ValidateToken(ctx context.Context, id *types.StringID) (*types.User, error)

ValidateToken accepts the token and returns an error if the user cannot login.

Jump to

Keyboard shortcuts

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