daemon

package
v0.0.0-...-12e41be Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2015 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Listen        string
	ManageListen  string
	WorkerLimit   int
	WorkerDefault int
	LoadDir       string
	ListenLimit   int
	LogLevel      int
}

func LoadConfig

func LoadConfig(filename string) (Config, error)

type Daemon

type Daemon struct {
	Config

	Queue       chan Request
	PoolCounter chan bool
	MaxWorker   chan int
	MngQ        []chan ManageRequest
}

func NewDaemon

func NewDaemon(conf Config) *Daemon

func (*Daemon) BroadcastManageReq

func (d *Daemon) BroadcastManageReq(req ManageRequest) error

func (*Daemon) JsonHandler

func (d *Daemon) JsonHandler(w http.ResponseWriter, r *http.Request)

func (*Daemon) ManageHandler

func (d *Daemon) ManageHandler(w http.ResponseWriter, r *http.Request)

func (*Daemon) PhpHandler

func (d *Daemon) PhpHandler(w http.ResponseWriter, r *http.Request)

func (*Daemon) QueryStreams

func (d *Daemon) QueryStreams(name string, querys Querys) (res []*core.Relation, endCh chan bool, err error)

func (*Daemon) RelationsToPhpArray

func (d *Daemon) RelationsToPhpArray(rs []*core.Relation, querys Querys) (string, error)

func (*Daemon) Serve

func (d *Daemon) Serve(ctx context.Context) error

func (*Daemon) UtilServe

func (d *Daemon) UtilServe()

func (*Daemon) Worker

func (d *Daemon) Worker(ctx context.Context, ManageCh chan ManageRequest)

type ManageCmd

type ManageCmd uint
const (
	PostNode ManageCmd = 1 << iota
	MoveNode
	DelNode
	GetNodeList
	GetNodes

	PPROF_FILE = "/tmp/gordb.pprof"
)

type ManageRequest

type ManageRequest struct {
	Cmd   ManageCmd
	Name  string
	Path  string
	Node  *core.Node
	ResCh chan ManageResponse
	From  string
	To    string
}

type ManageResponse

type ManageResponse struct {
	Body interface{}
	Err  error
}

type Options

type Options struct {
	core.PhpOptions
	OrderDesc  bool   `json:"order_by,omitempty"`
	OrderBy    string `json:"order_desc,omitempty"`
	QueryCache bool   `json:"query_cache,omitempty"`
}

type Query

type Query struct {
	Options     `json:"options"`
	core.Stream `json:"stream"`
}

type Querys

type Querys []Query

type Request

type Request struct {
	Query core.Stream
	Name  string
	ResCh chan Response
	EndCh chan bool
}

type Response

type Response struct {
	Result *core.Relation
	Err    error
}

type Worker

type Worker struct {
	*Daemon
	DataBuf [][]core.Value
}

func NewWorker

func NewWorker(d *Daemon) *Worker

Jump to

Keyboard shortcuts

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