database_js.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Copyright 2014 The go-ethereum Authors
  2. // This file is part of the go-ethereum library.
  3. //
  4. // The go-ethereum 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-ethereum 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-ethereum library. If not, see <http://www.gnu.org/licenses/>.
  16. // +build js
  17. package ethdb
  18. import (
  19. "errors"
  20. )
  21. var errNotSupported = errors.New("ethdb: not supported")
  22. type LDBDatabase struct {
  23. }
  24. // NewLDBDatabase returns a LevelDB wrapped object.
  25. func NewLDBDatabase(file string, cache int, handles int) (*LDBDatabase, error) {
  26. return nil, errNotSupported
  27. }
  28. // Path returns the path to the database directory.
  29. func (db *LDBDatabase) Path() string {
  30. return ""
  31. }
  32. // Put puts the given key / value to the queue
  33. func (db *LDBDatabase) Put(key []byte, value []byte) error {
  34. return errNotSupported
  35. }
  36. func (db *LDBDatabase) Has(key []byte) (bool, error) {
  37. return false, errNotSupported
  38. }
  39. // Get returns the given key if it's present.
  40. func (db *LDBDatabase) Get(key []byte) ([]byte, error) {
  41. return nil, errNotSupported
  42. }
  43. // Delete deletes the key from the queue and database
  44. func (db *LDBDatabase) Delete(key []byte) error {
  45. return errNotSupported
  46. }
  47. func (db *LDBDatabase) Close() {
  48. }
  49. // Meter configures the database metrics collectors and
  50. func (db *LDBDatabase) Meter(prefix string) {
  51. }
  52. func (db *LDBDatabase) NewBatch() Batch {
  53. return nil
  54. }