2021-04-10 12:02:51 +00:00
|
|
|
package daughters
|
|
|
|
|
|
|
|
import "sync"
|
|
|
|
|
|
|
|
// Prm groups the required parameters of the Storage's constructor.
|
|
|
|
//
|
|
|
|
// All values must comply with the requirements imposed on them.
|
|
|
|
// Passing incorrect parameter values will result in constructor
|
|
|
|
// failure (error or panic depending on the implementation).
|
|
|
|
//
|
|
|
|
// The component is not parameterizable at the moment.
|
|
|
|
type Prm struct{}
|
|
|
|
|
|
|
|
// Storage represents in-memory storage of local trust
|
|
|
|
// values of the daughter peers.
|
|
|
|
//
|
|
|
|
// It maps epoch numbers to the repositories of local trusts
|
|
|
|
// of the daughter peers.
|
|
|
|
//
|
|
|
|
// For correct operation, Storage must be created
|
|
|
|
// using the constructor (New) based on the required parameters
|
|
|
|
// and optional components. After successful creation,
|
|
|
|
// Storage is immediately ready to work through API.
|
|
|
|
type Storage struct {
|
|
|
|
mtx sync.RWMutex
|
|
|
|
|
2021-04-29 06:33:09 +00:00
|
|
|
mItems map[uint64]*DaughterStorage
|
2021-04-10 12:02:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// New creates a new instance of the Storage.
|
|
|
|
//
|
|
|
|
// The created Storage does not require additional
|
|
|
|
// initialization and is completely ready for work.
|
|
|
|
func New(_ Prm) *Storage {
|
|
|
|
return &Storage{
|
2021-04-29 06:33:09 +00:00
|
|
|
mItems: make(map[uint64]*DaughterStorage),
|
2021-04-10 12:02:51 +00:00
|
|
|
}
|
|
|
|
}
|