github.com/alexdevranger/node-1.8.27@v0.0.0-20221128213301-aa5841e41d2d/ethdb/database_js.go (about) 1 // Copyright 2014 The go-ethereum Authors 2 // This file is part of the go-dubxcoin library. 3 // 4 // The go-dubxcoin library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The go-dubxcoin library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the go-dubxcoin library. If not, see <http://www.gnu.org/licenses/>. 16 17 // +build js 18 19 package ethdb 20 21 import ( 22 "errors" 23 ) 24 25 var errNotSupported = errors.New("ethdb: not supported") 26 27 type LDBDatabase struct { 28 } 29 30 // NewLDBDatabase returns a LevelDB wrapped object. 31 func NewLDBDatabase(file string, cache int, handles int) (*LDBDatabase, error) { 32 return nil, errNotSupported 33 } 34 35 // Path returns the path to the database directory. 36 func (db *LDBDatabase) Path() string { 37 return "" 38 } 39 40 // Put puts the given key / value to the queue 41 func (db *LDBDatabase) Put(key []byte, value []byte) error { 42 return errNotSupported 43 } 44 45 func (db *LDBDatabase) Has(key []byte) (bool, error) { 46 return false, errNotSupported 47 } 48 49 // Get returns the given key if it's present. 50 func (db *LDBDatabase) Get(key []byte) ([]byte, error) { 51 return nil, errNotSupported 52 } 53 54 // Delete deletes the key from the queue and database 55 func (db *LDBDatabase) Delete(key []byte) error { 56 return errNotSupported 57 } 58 59 func (db *LDBDatabase) Close() { 60 } 61 62 // Meter configures the database metrics collectors and 63 func (db *LDBDatabase) Meter(prefix string) { 64 } 65 66 func (db *LDBDatabase) NewBatch() Batch { 67 return nil 68 }