[#505] morph/container: Change get container API

Make `Get` method of the wrapper over Container contract's client to
accept binary container ID. Create `Get` function similar to the previous
`Get` variation. Use this function in Container service server in the place
where `Get` method was used.

Additionally implement `AsContainerSource` function which allows
to simply compose container Source interface from the wrapper.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-05-19 19:32:25 +03:00 committed by Alex Vanin
parent 6310535b3c
commit 83c27f6e8a
6 changed files with 33 additions and 19 deletions

View file

@ -42,7 +42,9 @@ func initContainerService(c *cfg) {
wrap, err := wrapper.NewFromMorph(c.cfgMorph.client, c.cfgContainer.scriptHash, 0)
fatalOnErr(err)
c.cfgObject.cnrStorage = newCachedContainerStorage(wrap) // use RPC node as source of containers (with caching)
cnrSrc := wrapper.AsContainerSource(wrap)
c.cfgObject.cnrStorage = newCachedContainerStorage(cnrSrc) // use RPC node as source of containers (with caching)
c.cfgObject.cnrClient = wrap
localMetrics := &localStorageLoad{
@ -63,7 +65,7 @@ func initContainerService(c *cfg) {
loadPlacementBuilder := &loadPlacementBuilder{
log: c.log,
nmSrc: c.cfgNetmap.wrapper,
cnrSrc: wrap,
cnrSrc: cnrSrc,
}
routeBuilder := placementrouter.New(placementrouter.Prm{