Пример #1
0
// registerState registers the state functionality for resources.
func (resources) registerState() {
	if !markRegistered(resource.ComponentName, "state") {
		return
	}

	newResources := func(persist corestate.Persistence) corestate.Resources {
		st := state.NewState(&resourceState{persist: persist})
		return st
	}

	corestate.SetResourcesComponent(newResources)
}
Пример #2
0
// NewResourceState is a function that may be passed to
// state.SetResourcesComponent().
func NewResourceState(persist corestate.Persistence, base *corestate.State) corestate.Resources {
	return state.NewState(&rawState{
		base:    base,
		persist: persist,
	})
}