sector

package
v0.0.0-...-72324ba Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

type Db interface {
	// 取得。
	Get(id string) (*Element, error)

	// 保存。
	// セクタ ID が既存のものと重複する場合は失敗し、既存のものを返す。
	SaveIfAbsent(elem *Element) (existing *Element, err error)
}

セクタ固有のアカウント ID の計算に使う情報の格納庫。

func NewMemoryDb

func NewMemoryDb() Db

func NewMongoDb

func NewMongoDb(pool *mgo.Session, db, coll string) Db

db: DB 名。 coll: コレクション名。

type Element

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

セクタ固有のアカウント ID の計算に使う情報。

func New

func New(id string, salt []byte) *Element

func (*Element) GetBSON

func (this *Element) GetBSON() (interface{}, error)
{
    "id": <セクタ ID>,
    "salt": <ソルト値>
}

func (*Element) Id

func (this *Element) Id() string

セクタ ID を返す。

func (*Element) Salt

func (this *Element) Salt() []byte

ソルト値を返す。

func (*Element) SetBSON

func (this *Element) SetBSON(raw bson.Raw) error

Jump to

Keyboard shortcuts

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