storage

package
v0.0.0-...-7f4249d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright 2018 The go-ethereum Authors This file is part of go-ethereum.

go-ethereum 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.

go-ethereum 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 go-ethereum. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AESEncryptedStorage

type AESEncryptedStorage struct {
	// contains filtered or unexported fields
}

AESEncryptedStorage is a storage type which is backed by a json-faile. The json-file contains key-value mappings, where the keys are _not_ encrypted, only the values are.

func NewAESEncryptedStorage

func NewAESEncryptedStorage(filename string, key []byte) *AESEncryptedStorage

NewAESEncryptedStorage creates a new encrypted storage backed by the given file/key

func (*AESEncryptedStorage) Get

func (s *AESEncryptedStorage) Get(key string) string

Get returns the previously stored value, or the empty string if it does not exist or key is of 0-length

func (*AESEncryptedStorage) Put

func (s *AESEncryptedStorage) Put(key, value string)

Put stores a value by key. 0-length keys results in no-op

type EphemeralStorage

type EphemeralStorage struct {
	// contains filtered or unexported fields
}

EphemeralStorage is an in-memory storage that does not persist values to disk. Mainly used for testing

func (*EphemeralStorage) Get

func (s *EphemeralStorage) Get(key string) string

func (*EphemeralStorage) Put

func (s *EphemeralStorage) Put(key, value string)

type Storage

type Storage interface {
	// Put stores a value by key. 0-length keys results in no-op
	Put(key, value string)
	// Get returns the previously stored value, or the empty string if it does not exist or key is of 0-length
	Get(key string) string
}

func NewEphemeralStorage

func NewEphemeralStorage() Storage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL