Documentation
¶
Index ¶
- Constants
- Variables
- func NewPgid(tableName string) uint64
- func SaveCatalog(dirPath string, c *Catalog) (err error)
- func SerializePage(p *Page) ([4096]byte, error)
- func SerializeTuple(t *Tuple) ([128]byte, error)
- type Catalog
- type Page
- type Storage
- func (s *Storage) CreateIndex(indexName string) (*meta.BTree, error)
- func (s *Storage) InsertIndex(indexName string, item meta.Item) error
- func (s *Storage) InsertTuple(tablename string, t *Tuple)
- func (s *Storage) ReadIndex(indexName string) (*meta.BTree, error)
- func (s *Storage) ReadTuple(tableName string, tid uint64) (*Tuple, error)
- func (s *Storage) Terminate() error
- type Transaction
- type TransactionManager
- type TransactionState
- type Tuple
- func (m *Tuple) CanSee(tran *Transaction) bool
- func (*Tuple) Descriptor() ([]byte, []int)
- func (m *Tuple) Equal(order int, s string, n int) bool
- func (m *Tuple) GetData() []*TupleData
- func (m *Tuple) GetMaxTxId() uint64
- func (m *Tuple) GetMinTxId() uint64
- func (m *Tuple) IsUnused() bool
- func (m *Tuple) Less(than meta.Item) bool
- func (*Tuple) ProtoMessage()
- func (m *Tuple) Reset()
- func (m *Tuple) String() string
- func (m *Tuple) XXX_DiscardUnknown()
- func (m *Tuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Tuple) XXX_Merge(src proto.Message)
- func (m *Tuple) XXX_Size() int
- func (m *Tuple) XXX_Unmarshal(b []byte) error
- type TupleData
- func (*TupleData) Descriptor() ([]byte, []int)
- func (m *TupleData) GetNumber() int32
- func (m *TupleData) GetString_() string
- func (m *TupleData) GetType() TupleData_Type
- func (*TupleData) ProtoMessage()
- func (m *TupleData) Reset()
- func (m *TupleData) String() string
- func (m *TupleData) XXX_DiscardUnknown()
- func (m *TupleData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TupleData) XXX_Merge(src proto.Message)
- func (m *TupleData) XXX_Size() int
- func (m *TupleData) XXX_Unmarshal(b []byte) error
- type TupleData_Type
Constants ¶
View Source
const (
TupleNumber = 32
)
Variables ¶
View Source
var TupleData_Type_name = map[int32]string{
0: "INT",
1: "STRING",
}
View Source
var TupleData_Type_value = map[string]int32{
"INT": 0,
"STRING": 1,
}
Functions ¶
func SaveCatalog ¶
SaveCatalog persists the system catalog as `catalog.db`. `catalog.db` has a simple json format like key/value.
func SerializePage ¶
func SerializeTuple ¶
Types ¶
type Catalog ¶
func LoadCatalog ¶
func NewEmtpyCatalog ¶
func NewEmtpyCatalog() *Catalog
type Page ¶
type Page struct {
Tuples [TupleNumber]Tuple
}
Page is fixed-sized(4KB) byte.
func DeserializePage ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is the interface of any manipulation of read/write.
func NewStorage ¶
func (*Storage) InsertTuple ¶
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func (*Transaction) Txid ¶
func (t *Transaction) Txid() uint64
type TransactionManager ¶
type TransactionManager struct {
// contains filtered or unexported fields
}
func NewTransactionManager ¶
func NewTransactionManager() *TransactionManager
func (*TransactionManager) Abort ¶
func (t *TransactionManager) Abort(tran *Transaction)
func (*TransactionManager) BeginTransaction ¶
func (t *TransactionManager) BeginTransaction() *Transaction
func (*TransactionManager) Commit ¶
func (t *TransactionManager) Commit(tran *Transaction)
type TransactionState ¶
type TransactionState int
const ( Commited TransactionState = iota + 1 InProgress Abort )
type Tuple ¶
type Tuple struct { MinTxId uint64 `protobuf:"varint,1,opt,name=minTxId,proto3" json:"minTxId,omitempty"` MaxTxId uint64 `protobuf:"varint,2,opt,name=maxTxId,proto3" json:"maxTxId,omitempty"` Data []*TupleData `protobuf:"bytes,3,rep,name=data,proto3" json:"data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func DeserializeTuple ¶
func (*Tuple) CanSee ¶
func (m *Tuple) CanSee(tran *Transaction) bool
func (*Tuple) Descriptor ¶
func (*Tuple) GetMaxTxId ¶
func (*Tuple) GetMinTxId ¶
func (*Tuple) ProtoMessage ¶
func (*Tuple) ProtoMessage()
func (*Tuple) XXX_DiscardUnknown ¶
func (m *Tuple) XXX_DiscardUnknown()
func (*Tuple) XXX_Marshal ¶
func (*Tuple) XXX_Unmarshal ¶
type TupleData ¶
type TupleData struct { Type TupleData_Type `protobuf:"varint,3,opt,name=type,proto3,enum=storage.TupleData_Type" json:"type,omitempty"` Number int32 `protobuf:"varint,4,opt,name=number,proto3" json:"number,omitempty"` String_ string `protobuf:"bytes,5,opt,name=string,proto3" json:"string,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*TupleData) Descriptor ¶
func (*TupleData) GetString_ ¶
func (*TupleData) GetType ¶
func (m *TupleData) GetType() TupleData_Type
func (*TupleData) ProtoMessage ¶
func (*TupleData) ProtoMessage()
func (*TupleData) XXX_DiscardUnknown ¶
func (m *TupleData) XXX_DiscardUnknown()
func (*TupleData) XXX_Marshal ¶
func (*TupleData) XXX_Unmarshal ¶
type TupleData_Type ¶
type TupleData_Type int32
const ( TupleData_INT TupleData_Type = 0 TupleData_STRING TupleData_Type = 1 )
func (TupleData_Type) EnumDescriptor ¶
func (TupleData_Type) EnumDescriptor() ([]byte, []int)
func (TupleData_Type) String ¶
func (x TupleData_Type) String() string
Click to show internal directories.
Click to hide internal directories.