Esempio n. 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
}
Esempio n. 2
0
func NewAutoIncId() IdGenerator {
	return &autoincId{autoinc.New(1, 1)}
}
Esempio n. 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
}
Esempio n. 4
0
func NewAutoIncId() *autoincId {
	return &autoincId{autoinc.New(1, 1)}
}