server

package
v0.0.0-...-c91f54c Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CREATE_JOB     = "create_job"
	STOP_JOB       = "stop_job"
	DESTORY_RUNNER = "destory"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	DB        pg.DBConf
	Minio     minio.MinioConf
	Redis     redis.RedisConf
	Scheduler SchedulerConf
}

func LoadConf

func LoadConf() (conf Conf, err error)

LoadConf load config from env

func (*Conf) Validate

func (c *Conf) Validate() (err error)

type SchedulerConf

type SchedulerConf struct {
	Port              int
	ShutdownWaitInSec time.Duration
}

type Servlet

type Servlet struct {
	Conf  Conf
	DB    *gorm.DB
	Minio *minio.Client
	Redis redis.Conn
}

func New

func New(conf Conf) (s *Servlet, err error)

func (*Servlet) CheckTokenExisted

func (s *Servlet) CheckTokenExisted(token string) (err error)

func (*Servlet) CreateJob

func (s *Servlet) CreateJob(ctx context.Context, req *pb.CreateJobRequest) (resp *pb.CreateJobResponse, err error)

func (*Servlet) CreateRunner

func (s *Servlet) CreateRunner(runnerID string) (runner *m.Runner, err error)

func (*Servlet) DestoryRunner

func (s *Servlet) DestoryRunner(ctx context.Context, req *pb.DestoryRunnerRequest) (resp *pb.DestoryRunnerResponse, err error)

func (*Servlet) Free

func (s *Servlet) Free()

func (*Servlet) HeartBeat

func (s *Servlet) HeartBeat(ctx context.Context, req *pb.HeartBeatRequest) (resp *pb.HeartBeatResponse, err error)

HeartBeat update job and runner info stored in database.

func (*Servlet) RemoveJob

func (s *Servlet) RemoveJob(ctx context.Context, req *pb.RemoveJobRequest) (resp *pb.RemoveJobResponse, err error)

func (*Servlet) SelectIdleRunner

func (s *Servlet) SelectIdleRunner() (runner *m.Runner, err error)

func (*Servlet) StartOrDie

func (s *Servlet) StartOrDie() (err error)

func (*Servlet) StopJob

func (s *Servlet) StopJob(ctx context.Context, req *pb.StopJobRequest) (resp *pb.StopJobResponse, err error)

Jump to

Keyboard shortcuts

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