storage.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * EliasDB
  3. *
  4. * Copyright 2016 Matthias Ladkau. All rights reserved.
  5. *
  6. * This Source Code Form is subject to the terms of the Mozilla Public
  7. * License, v. 2.0. If a copy of the MPL was not distributed with this
  8. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  9. */
  10. package graphstorage
  11. import "devt.de/krotik/eliasdb/storage"
  12. /*
  13. Storage interface models the storage backend for a graph manager.
  14. */
  15. type Storage interface {
  16. /*
  17. Name returns the name of the GraphStorage instance.
  18. */
  19. Name() string
  20. /*
  21. MainDB returns the main database. The main database is a quick
  22. lookup map for meta data which is always kept in memory.
  23. */
  24. MainDB() map[string]string
  25. /*
  26. RollbackMain rollback the main database.
  27. */
  28. RollbackMain() error
  29. /*
  30. FlushMain writes the main database to the storage.
  31. */
  32. FlushMain() error
  33. /*
  34. FlushAll writes all pending changes to the storage.
  35. */
  36. FlushAll() error
  37. /*
  38. StorageManager gets a storage manager with a certain name. A non-existing
  39. StorageManager is not created automatically if the create flag is set to false.
  40. */
  41. StorageManager(smname string, create bool) storage.Manager
  42. /*
  43. Close closes the storage.
  44. */
  45. Close() error
  46. }