client

package
v1.0.2-0...-5341065 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2015 License: GPL-3.0 Imports: 12 Imported by: 0

README

go test -conf=./test-examples.conf

Documentation

Index

Constants

View Source
const (
	RPCPing    = "SnowflakeRPC.Ping"
	RPCNextId  = "SnowflakeRPC.NextId"
	RPCNextIds = "SnowflakeRPC.NextIds"
)

Variables

View Source
var (
	ErrNoRpcClient = errors.New("rpc: no rpc client service")
)

Functions

func Init

func Init(zservers []string, zpath string, ztimeout time.Duration) (err error)

Init init the gosnowflake client.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is gosnowfalke client.

func NewClient

func NewClient(workerId int64) (c *Client)

NewClient new a gosnowfalke client.

func (*Client) Close

func (c *Client) Close()

Close destroy the client from global client cache.

func (*Client) Id

func (c *Client) Id() (id int64, err error)

Id generate a snowflake id.

func (*Client) Ids

func (c *Client) Ids(num int) (ids []int64, err error)

Ids generate a snowflake id.

type Peer

type Peer struct {
	RPC    []string `json:"rpc"`
	Thrift []string `json:"thrift"`
}

Peer store data in zookeeper.

Jump to

Keyboard shortcuts

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