pipeline

package
v0.0.0-...-5e73d17 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2016 License: GPL-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Author: Aosen QQ: 316052486 Data: 2016-01-14 Desc: 基于mysql的pipline实现, 本实例仅供参考,还需根据实际开发需求进行改装

Index

Constants

View Source
const (
	PersistentStorageFilePrefix = "db"
	StorageFolder               = "data"
)

Variables

View Source
var CreateTable string = `` /* 126-byte string literal not displayed */

Functions

func OpenOrCreateKv

func OpenOrCreateKv(path string, options *kv.Options) (*kv.DB, error)

打开或者创建KV数据库 当path指向的数据库存在时打开该数据库, 否则尝试在该路径处创建新数据库

Types

type KVPipline

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

func InitKV

func InitKV(shard int) *KVPipline

func (*KVPipline) Close

func (self *KVPipline) Close(shard int)

关闭数据连接

func (*KVPipline) Conn

func (self *KVPipline) Conn(shard int)

连接数据库

func (*KVPipline) Delete

func (self *KVPipline) Delete(shard int, key []byte)

func (*KVPipline) GetStorageShards

func (self *KVPipline) GetStorageShards() int

func (*KVPipline) Init

func (self *KVPipline) Init()

func (*KVPipline) Recover

func (self *KVPipline) Recover(shard int, internalIndexDocument func(docId uint64, data search.DocumentIndexData)) error

从shard 恢复数据

func (*KVPipline) Set

func (self *KVPipline) Set(shard int, key, value []byte)

将key-value存储到哪个集合中

type MongoPipline

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

func InitMongo

func InitMongo(db string, shardnum int, url string, collectionPrefix string) *MongoPipline

func (*MongoPipline) Close

func (self *MongoPipline) Close(shard int)

关闭数据库连接

func (*MongoPipline) Conn

func (self *MongoPipline) Conn(shard int)

连接数据库

func (*MongoPipline) Delete

func (self *MongoPipline) Delete(shard int, key []byte)

func (*MongoPipline) GetStorageShards

func (self *MongoPipline) GetStorageShards() int

func (*MongoPipline) Init

func (self *MongoPipline) Init()

func (*MongoPipline) Recover

func (self *MongoPipline) Recover(shard int, internalIndexDocument func(docId uint64, data search.DocumentIndexData)) error

func (*MongoPipline) Set

func (self *MongoPipline) Set(shard int, key, value []byte)

将key-value存储到哪个集合中

type MysqlPipline

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

func InitMysql

func InitMysql(dbinfo string, shardnum int, tablePrefix string) *MysqlPipline

func (*MysqlPipline) Close

func (self *MysqlPipline) Close(shard int)

关闭数据库连接

func (*MysqlPipline) Conn

func (self *MysqlPipline) Conn(shard int)

连接数据库

func (*MysqlPipline) Delete

func (self *MysqlPipline) Delete(shard int, key []byte)

数据删除

func (*MysqlPipline) GetStorageShards

func (self *MysqlPipline) GetStorageShards() int

func (*MysqlPipline) Init

func (self *MysqlPipline) Init()

如果没有表就创建表

func (*MysqlPipline) Recover

func (self *MysqlPipline) Recover(shard int, internalIndexDocument func(docId uint64, data search.DocumentIndexData)) error

数据恢复

func (*MysqlPipline) Set

func (self *MysqlPipline) Set(shard int, key, value []byte)

数据存储

Jump to

Keyboard shortcuts

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