예제 #1
0
// Create a new client.
// Connect to "addr" through "network"
// Eg.
//      client, err := client.New("127.0.0.1:4730")
func New(addr string) (client *Client, err error) {
	conn, err := net.Dial(common.NETWORK, addr)
	if err != nil {
		return
	}
	client = &Client{
		jobCreated: make(chan *Job),
		in:         make(chan []byte, common.QUEUE_SIZE),
		out:        make(chan *Job, common.QUEUE_SIZE),
		conn:       conn,
		ai:         autoinc.New(0, 1),
		TimeOut:    time.Second,
	}
	go client.inLoop()
	go client.outLoop()
	return
}
예제 #2
0
파일: id.go 프로젝트: jasonmoo/gearman-go
func NewAutoIncId() IdGenerator {
	return &autoincId{autoinc.New(1, 1)}
}
예제 #3
0
package scheduler

import (
	"github.com/mikespook/golib/autoinc"
	"github.com/mikespook/golib/log"
	"testing"
	"time"
)

var (
	ai = autoinc.New(0, 1)
)

type _task struct {
	start    time.Duration
	iterate  int
	interval time.Duration
	id       int
}

func (t *_task) Start() time.Duration {
	return t.start
}

func (t *_task) SetStart(tm time.Duration) {
	t.start = tm
}

func (t *_task) Interval() time.Duration {
	return 0
}
예제 #4
0
파일: id.go 프로젝트: mikespook/golib
func NewAutoIncId() *autoincId {
	return &autoincId{autoinc.New(1, 1)}
}