Documentation ¶
Overview ¶
This is just a prototype. Please do not use it.
This is just a prototype. Please do not use it.
Index ¶
- Constants
- Variables
- type Backend
- type Collection
- type DB
- type DeleteFlags
- type Header
- type InsertFlags
- type MemoryBackend
- func (b *MemoryBackend) DB(name string) DB
- func (b *MemoryBackend) DBNames() (result []string)
- func (b *MemoryBackend) HandleDelete(c net.Conn, deleteMsg *OpDeleteMsg)
- func (b *MemoryBackend) HandleInsert(c net.Conn, insert *OpInsertMsg)
- func (b *MemoryBackend) HandleQuery(c net.Conn, query *OpQueryMsg)
- func (b *MemoryBackend) HandleUpdate(c net.Conn, update *OpUpdateMsg)
- type MemoryCollection
- func (c *MemoryCollection) All() (result []interface{})
- func (c *MemoryCollection) Delete(pattern bson.M, limit int) int
- func (c *MemoryCollection) Id(id string) interface{}
- func (c *MemoryCollection) Insert(doc interface{}) error
- func (c *MemoryCollection) Match(pattern bson.M) (result []interface{})
- type MemoryDB
- type OpCode
- type OpDeleteMsg
- type OpInsertMsg
- type OpQueryMsg
- type OpReplyMsg
- type OpUpdateMsg
- type QueryFlags
- type Server
- type TikvBackend
- func (b *TikvBackend) DB(name string) DB
- func (b *TikvBackend) DBNames() (result []string)
- func (b *TikvBackend) HandleDelete(c net.Conn, deleteMsg *OpDeleteMsg)
- func (b *TikvBackend) HandleInsert(c net.Conn, insert *OpInsertMsg)
- func (b *TikvBackend) HandleQuery(c net.Conn, query *OpQueryMsg)
- func (b *TikvBackend) HandleUpdate(c net.Conn, update *OpUpdateMsg)
- type TikvCollection
- type TikvDB
- type UpdateFlags
- type WriteResult
Constants ¶
View Source
const ( ConnectionPrefix = "C" DocumentPrefix = "D" )
View Source
const ( QueryFlagTailableCursor = 1 << 1 QueryFlagSlaveOk = 1 << 2 QueryFlagOplogReplay = 1 << 3 QueryFlagNoCursorTimeout = 1 << 4 QueryFlagAwaitData = 1 << 5 QueryFlagExhaust = 1 << 6 QueryFlagPartial = 1 << 7 )
View Source
const ( UpdateFlagUpsert = 1 << 0 UpdateFlagMultiUpdate = 1 << 1 )
View Source
const (
DeleteFlagSingleRemove = 1 << 0
)
View Source
const (
InsertFlagContinueOnError = 1 << 0
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { HandleQuery(c net.Conn, query *OpQueryMsg) HandleInsert(c net.Conn, insert *OpInsertMsg) HandleUpdate(c net.Conn, update *OpUpdateMsg) HandleDelete(c net.Conn, deleteMsg *OpDeleteMsg) DBNames() []string DB(name string) DB }
type Collection ¶
type DB ¶
type DB interface { Empty() bool CNames() []string C(name string) Collection LastError() interface{} SetLastError(doc interface{}) }
type DeleteFlags ¶
type DeleteFlags int32
type InsertFlags ¶
type InsertFlags int32
type MemoryBackend ¶
type MemoryBackend struct {
// contains filtered or unexported fields
}
func NewMemoryBackend ¶
func NewMemoryBackend(t *tomb.Tomb) *MemoryBackend
func (*MemoryBackend) DB ¶
func (b *MemoryBackend) DB(name string) DB
func (*MemoryBackend) DBNames ¶
func (b *MemoryBackend) DBNames() (result []string)
func (*MemoryBackend) HandleDelete ¶
func (b *MemoryBackend) HandleDelete(c net.Conn, deleteMsg *OpDeleteMsg)
func (*MemoryBackend) HandleInsert ¶
func (b *MemoryBackend) HandleInsert(c net.Conn, insert *OpInsertMsg)
func (*MemoryBackend) HandleQuery ¶
func (b *MemoryBackend) HandleQuery(c net.Conn, query *OpQueryMsg)
func (*MemoryBackend) HandleUpdate ¶
func (b *MemoryBackend) HandleUpdate(c net.Conn, update *OpUpdateMsg)
type MemoryCollection ¶
type MemoryCollection struct {
// contains filtered or unexported fields
}
func (*MemoryCollection) All ¶
func (c *MemoryCollection) All() (result []interface{})
func (*MemoryCollection) Id ¶
func (c *MemoryCollection) Id(id string) interface{}
func (*MemoryCollection) Insert ¶
func (c *MemoryCollection) Insert(doc interface{}) error
func (*MemoryCollection) Match ¶
func (c *MemoryCollection) Match(pattern bson.M) (result []interface{})
type MemoryDB ¶
type MemoryDB struct {
// contains filtered or unexported fields
}
func NewMemoryDB ¶
func NewMemoryDB() *MemoryDB
func (*MemoryDB) C ¶
func (db *MemoryDB) C(name string) Collection
func (*MemoryDB) SetLastError ¶
func (db *MemoryDB) SetLastError(doc interface{})
type OpDeleteMsg ¶
type OpDeleteMsg struct { *Header // "dbname.collectionname" FullCollectionName string // Bit vector of update options. Flags DeleteFlags // Selector matches the documents to delete. Selector bson.M // contains filtered or unexported fields }
func NewOpDeleteMsg ¶
func NewOpDeleteMsg(h *Header) (*OpDeleteMsg, error)
type OpInsertMsg ¶
type OpInsertMsg struct { *Header // Bit vector of query options. Flags InsertFlags // The full name of the collection. FullCollectionName string // One or more documents to insert into the collection. Docs []bson.M }
func NewOpInsertMsg ¶
func NewOpInsertMsg(h *Header) (*OpInsertMsg, error)
type OpQueryMsg ¶
type OpQueryMsg struct { *Header // Bit vector of query options. Flags QueryFlags // The full name of a collection. FullCollectionName string // Number of documents to skip. NumberToSkip int32 // Number of documents to return in the first OP_REPLY batch. NumberToReturn int32 // Query object. See below for details. Doc bson.D // Optional. Selector indicating the fields to return. ReturnFieldsSelector bson.D }
func NewOpQueryMsg ¶
func NewOpQueryMsg(h *Header) (*OpQueryMsg, error)
func (*OpQueryMsg) Command ¶
func (msg *OpQueryMsg) Command() (cmd string, arg interface{})
func (*OpQueryMsg) Get ¶
func (msg *OpQueryMsg) Get(key string) (interface{}, bool)
type OpReplyMsg ¶
type OpReplyMsg struct { *Header // Bit vector - see details below. ResponseFlags int32 // Cursor id if client needs to do get more's. CursorID int64 // Where in the cursor this reply is starting. StartingFrom int32 // Number of documents in the reply. NumberReturned int32 Docs []interface{} // contains filtered or unexported fields }
func NewOpReplyMsg ¶
func NewOpReplyMsg(responseTo int32, docs ...interface{}) *OpReplyMsg
type OpUpdateMsg ¶
type OpUpdateMsg struct { *Header // "dbname.collectionname" FullCollectionName string // Bit vector of update options. Flags UpdateFlags // Selector is the query to select the document. Selector bson.M // Update is the document update specification. Update bson.M // contains filtered or unexported fields }
func NewOpUpdateMsg ¶
func NewOpUpdateMsg(h *Header) (*OpUpdateMsg, error)
type QueryFlags ¶
type QueryFlags int32
type Server ¶
type Server struct { Backend Backend // contains filtered or unexported fields }
func NewServerAddr ¶
type TikvBackend ¶
type TikvBackend struct {
// contains filtered or unexported fields
}
func NewTikvBackend ¶
func NewTikvBackend(t *tomb.Tomb, path string) (*TikvBackend, error)
func (*TikvBackend) DB ¶
func (b *TikvBackend) DB(name string) DB
func (*TikvBackend) DBNames ¶
func (b *TikvBackend) DBNames() (result []string)
func (*TikvBackend) HandleDelete ¶
func (b *TikvBackend) HandleDelete(c net.Conn, deleteMsg *OpDeleteMsg)
func (*TikvBackend) HandleInsert ¶
func (b *TikvBackend) HandleInsert(c net.Conn, insert *OpInsertMsg)
func (*TikvBackend) HandleQuery ¶
func (b *TikvBackend) HandleQuery(c net.Conn, query *OpQueryMsg)
func (*TikvBackend) HandleUpdate ¶
func (b *TikvBackend) HandleUpdate(c net.Conn, update *OpUpdateMsg)
TODO: implement it.
type TikvCollection ¶
type TikvCollection struct {
// contains filtered or unexported fields
}
func (*TikvCollection) All ¶
func (c *TikvCollection) All() (result []interface{})
TODO: implement it.
func (*TikvCollection) Delete ¶
func (c *TikvCollection) Delete(pattern bson.M, limit int) int
TODO: implement it.
func (*TikvCollection) Insert ¶
func (c *TikvCollection) Insert(doc interface{}) error
func (*TikvCollection) Match ¶
func (c *TikvCollection) Match(pattern bson.M) []interface{}
type TikvDB ¶
type TikvDB struct {
// contains filtered or unexported fields
}
func (*TikvDB) C ¶
func (db *TikvDB) C(name string) Collection
func (*TikvDB) SetLastError ¶
func (db *TikvDB) SetLastError(doc interface{})
type UpdateFlags ¶
type UpdateFlags int32
type WriteResult ¶
Click to show internal directories.
Click to hide internal directories.