Documentation ¶
Index ¶
- type BoltDB
- func (c *BoltDB) AuthenticationTokenExists(token string) bool
- func (c *BoltDB) Close() error
- func (c *BoltDB) DeleteAuthenticationToken(token string) error
- func (c *BoltDB) DeleteJob(j *job.Job) error
- func (c *BoltDB) DeleteResult(r *job.Result) error
- func (c *BoltDB) GetJob(id int) (*job.Job, error)
- func (c *BoltDB) GetJobs(low, high int) ([]*job.Job, error)
- func (c *BoltDB) GetResult(j *job.Job, id int) (*job.Result, error)
- func (c *BoltDB) GetResults(j *job.Job, low, high int) ([]*job.Result, error)
- func (c *BoltDB) JobsLength() int
- func (c *BoltDB) ResultsLength(j *job.Job) int
- func (c *BoltDB) SaveAuthenticationToken(token string) error
- func (c *BoltDB) SaveJob(j *job.Job) error
- func (c *BoltDB) SaveResult(r *job.Result) error
- type Client
- type Dummy
- func (c *Dummy) AuthenticationTokenExists(token string) bool
- func (c *Dummy) Close() error
- func (c *Dummy) DeleteAuthenticationToken(token string) error
- func (c *Dummy) DeleteJob(j *job.Job) error
- func (c *Dummy) DeleteResult(r *job.Result) error
- func (c *Dummy) GetJob(id int) (job *job.Job, err error)
- func (c *Dummy) GetJobs(low, high int) (jobs []*job.Job, err error)
- func (c *Dummy) GetResult(j *job.Job, id int) (*job.Result, error)
- func (c *Dummy) GetResults(j *job.Job, low, high int) ([]*job.Result, error)
- func (c *Dummy) JobsLength() int
- func (c *Dummy) ResultsLength(j *job.Job) int
- func (c *Dummy) SaveAuthenticationToken(token string) error
- func (c *Dummy) SaveJob(j *job.Job) error
- func (c *Dummy) SaveResult(r *job.Result) error
- func (c *Dummy) UpdateJob(j *job.Job) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoltDB ¶
BoltDB client to store jobs on database
func (*BoltDB) AuthenticationTokenExists ¶
AuthenticationTokenExists Checks if an authentication token exists on boltdb
func (*BoltDB) DeleteAuthenticationToken ¶
DeleteAuthenticationToken Deletes an authentication token from boltdb, doesn't return error if doesnt exists
func (*BoltDB) DeleteJob ¶
DeleteJob deletes an HTTP job and all its results from boltdb, doesn't return error if job doesn't exists
func (*BoltDB) DeleteResult ¶
DeleteResult deletes a result from boltdv, doesn't return error if result doesn't exist
func (*BoltDB) GetJobs ¶
GetJobs returns all the HTTP jobs from boltdb. Use low and high params as slice operator
func (*BoltDB) GetResults ¶
GetResults returns all the results of a jobs from boltdb. Use low and high params as slice operator
func (*BoltDB) JobsLength ¶
JobsLength returns the number of jobs stored on boltdb
func (*BoltDB) ResultsLength ¶
ResultsLength returns the number of results(of a job) stored in boltdb
func (*BoltDB) SaveAuthenticationToken ¶
SaveAuthenticationToken stores an authentication token on boltdb
type Client ¶
type Client interface { Close() error // Job actions // GetJobs returns an slice of job instances; the low parmeter will be the // first job and the high will be the next one to the last job that will be // returned; this acts like an slice operator. 0 on high parameter means all. // this would be translated as jobs[low:] and 0 on low would be jobs[:high] GetJobs(low, high int) ([]*job.Job, error) // GetJob returns a job by ID GetJob(id int) (*job.Job, error) // SaveJob stores the job; this method works as an insert or update, the // method will know if the job needs to be updated or inserted by identifying // the presence of the ID. This wil save as a batch so on an update the // instance should have all the fields set SaveJob(j *job.Job) error // DeleteJob deletes a job DeleteJob(j *job.Job) error // JobsLength returns the number of jobs stored JobsLength() int // Result actions // GetResults returns an slice of results from a job; The low parmeter will be the // first result and the high will be the next one to the last result that will be // returned; this acts like an slice operator. 0 on high parameter means all. // this would be translated as results[low:] and 0 on low would be results[:high] GetResults(j *job.Job, low, high int) ([]*job.Result, error) // GetResult returns a result based on the result id of a job GetResult(j *job.Job, id int) (*job.Result, error) // SaveResult stores the result. Results cannot be updated SaveResult(r *job.Result) error // DeleteResult deletes a result DeleteResult(r *job.Result) error // ResultsLength returns the number of results (of a job) stored ResultsLength(j *job.Job) int // SaveAuthenticationToken stores an authentication token on database SaveAuthenticationToken(token string) error // DeleteAuthenticationToken Deletes an authentication token from database DeleteAuthenticationToken(token string) error // AuthenticationTokenExists Checks if an authentication token exists AuthenticationTokenExists(token string) bool }
Client implements the client of an storage
type Dummy ¶
type Dummy struct { Jobs map[string]*job.Job JobCounter int Results map[string]map[string]*job.Result ResultsCounter map[string]int TokenMutex *sync.Mutex Tokens map[string]struct{} // contains filtered or unexported fields }
Dummy implements the Storage interface everything to a local memory map
func (*Dummy) AuthenticationTokenExists ¶
AuthenticationTokenExists Checks if an authentication token exists
func (*Dummy) DeleteAuthenticationToken ¶
DeleteAuthenticationToken Deletes an authentication token from database
func (*Dummy) DeleteResult ¶
DeleteResult deletes a job on ajob in memory
func (*Dummy) GetResults ¶
GetResults returns results from a job on memory
func (*Dummy) JobsLength ¶
JobsLength returns the number of jobs stored
func (*Dummy) ResultsLength ¶
ResultsLength returns the number of results stored
func (*Dummy) SaveAuthenticationToken ¶
SaveAuthenticationToken stores an authentication token on database
func (*Dummy) SaveResult ¶
SaveResult saves a result on a job in memory