github.com/iotexproject/iotex-core@v1.14.1-rc1/db/trie/kvstore.go (about)

     1  // Copyright (c) 2018 IoTeX
     2  // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
     3  // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
     4  // This source code is governed by Apache License 2.0 that can be found in the LICENSE file.
     5  
     6  package trie
     7  
     8  import (
     9  	"context"
    10  )
    11  
    12  // KVStore defines an interface for storing trie data as key-value pair
    13  type KVStore interface {
    14  	// Start starts the KVStore
    15  	Start(context.Context) error
    16  	// Stop stops the KVStore
    17  	Stop(context.Context) error
    18  	// Put puts key, value pair into KVStore
    19  	Put([]byte, []byte) error
    20  	// Delete deletes record from KVStore by key
    21  	Delete([]byte) error
    22  	// Get gets the value from KVStore by key
    23  	Get([]byte) ([]byte, error)
    24  }