Documentation ¶
Overview ¶
Copyright (C) 2018 go-gamc authors
This file is part of the go-gamc library.
the go-gamc library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
the go-gamc library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the go-gamc library. If not, see <http://www.gnu.org/licenses/>.
Copyright (C) 2018 go-gamc authors ¶
This file is part of the go-gamc library.
the go-gamc library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
the go-gamc library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the go-gamc library. If not, see <http://www.gnu.org/licenses/>.
Copyright (C) 2018 go-gamc authors ¶
This file is part of the go-gamc library.
the go-gamc library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
the go-gamc library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the go-gamc library. If not, see <http://www.gnu.org/licenses/>.
Copyright (C) 2018 go-gamc authors ¶
This file is part of the go-gamc library.
the go-gamc library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
the go-gamc library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the go-gamc library. If not, see <http://www.gnu.org/licenses/>.
Copyright (C) 2018 go-gamc authors ¶
This file is part of the go-gamc library.
the go-gamc library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
the go-gamc library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the go-gamc library. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Constants
- Variables
- func NewgamcDB(filename string) (*gamcDB, error)
- type Batcher
- type Compacter
- type Database
- func (d *Database) Close() error
- func (d *Database) Delete(key []byte) error
- func (d *Database) DisableBatch()
- func (d *Database) EnableBatch()
- func (d *Database) Flush() error
- func (d *Database) Get(key []byte) ([]byte, error)
- func (d *Database) Has(key []byte) (bool, error)
- func (d *Database) Put(key, value []byte) error
- func (d *Database) ValueSize() int
- type DbConfig
- type Iteratee
- type Iterator
- type LevelDB
- func (db *LevelDB) Close() error
- func (db *LevelDB) Compact(start []byte, limit []byte) error
- func (db *LevelDB) Delete(key []byte) error
- func (db *LevelDB) DisableBatch()
- func (db *LevelDB) EnableBatch()
- func (db *LevelDB) Flush() error
- func (db *LevelDB) Get(key []byte) ([]byte, error)
- func (db *LevelDB) Has(key []byte) (bool, error)
- func (db *LevelDB) NewIterator() Iterator
- func (db *LevelDB) NewIteratorWithPrefix(prefix []byte) Iterator
- func (db *LevelDB) Put(key, value []byte) error
- func (db *LevelDB) ValueSize() int
- type MemoryBatch
- type MemoryDB
- func (db *MemoryDB) Close() error
- func (db *MemoryDB) Del(key []byte) error
- func (db *MemoryDB) Delete(key []byte) error
- func (db *MemoryDB) DisableBatch()
- func (db *MemoryDB) EnableBatch()
- func (db *MemoryDB) Flush() error
- func (db *MemoryDB) Get(key []byte) ([]byte, error)
- func (db *MemoryDB) Has(key []byte) (bool, error)
- func (db *MemoryDB) Put(key []byte, value []byte) error
- func (db *MemoryDB) ValueSize() int
- type Reader
- type Stater
- type Storage
- type Writer
Constants ¶
const IdealBatchSize = 100 * 1024 //
const (
TypeLevelDB = "levelDB"
)
Variables ¶
var ( ErrBucketNotExist = errors.New("bucket does not exist") ErrKeyNotExist = errors.New("key does not exist") )
var (
ErrKeyNotFound = errors.New("not found")
)
Functions ¶
Types ¶
type Database ¶
type Database struct {
Db Storage
}
func (*Database) DisableBatch ¶
func (d *Database) DisableBatch()
func (*Database) EnableBatch ¶
func (d *Database) EnableBatch()
type DbConfig ¶
type DbConfig struct { DbType string `yaml:"db_type"` EnableBatch bool `yaml:"enable_batch"` DbDir string `yaml:"db_dir"` }
func GetDbConfig ¶
func NewDefaultDbConfig ¶
func NewDefaultDbConfig() *DbConfig
type LevelDB ¶
type LevelDB struct {
// contains filtered or unexported fields
}
func (*LevelDB) DisableBatch ¶
func (db *LevelDB) DisableBatch()
func (*LevelDB) EnableBatch ¶
func (db *LevelDB) EnableBatch()
func (*LevelDB) NewIterator ¶
func (*LevelDB) NewIteratorWithPrefix ¶
type MemoryBatch ¶
type MemoryBatch struct {
// contains filtered or unexported fields
}
MemoryBatch do batch task in memory storage
type MemoryDB ¶
type MemoryDB struct {
// contains filtered or unexported fields
}
MemoryDB the nodes in trie.
func (*MemoryDB) DisableBatch ¶
func (db *MemoryDB) DisableBatch()
DisableBatch disable batch write.