make path/url be a map of network name to car uri
This commit is contained in:
parent
d949b6c8ef
commit
ccb2e44e36
@ -21,13 +21,18 @@ type Bundle struct {
|
|||||||
// Release is the release id
|
// Release is the release id
|
||||||
Release string
|
Release string
|
||||||
// Path is the (optional) bundle path; takes precedence over url
|
// Path is the (optional) bundle path; takes precedence over url
|
||||||
Path string
|
Path map[string]string
|
||||||
// URL is the (optional) bundle URL; takes precdence over github release
|
// URL is the (optional) bundle URL; takes precdence over github release
|
||||||
URL string
|
URL map[string]BundleURL
|
||||||
// CHecksum is the bundle sha256 checksume in hex, when specifying a URL.
|
|
||||||
Checksum string
|
|
||||||
// Devlopment indicates whether this is a development version; when set, in conjunction with path,
|
// Devlopment indicates whether this is a development version; when set, in conjunction with path,
|
||||||
// it will always load the bundle to the blockstore, without recording the manifest CID in the
|
// it will always load the bundle to the blockstore, without recording the manifest CID in the
|
||||||
// datastore.
|
// datastore.
|
||||||
Development bool
|
Development bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type BundleURL struct {
|
||||||
|
// URL is the url of the bundle
|
||||||
|
URL string
|
||||||
|
// Checksum is the sha256 checksum of the bundle
|
||||||
|
Checksum string
|
||||||
|
}
|
||||||
|
@ -97,13 +97,13 @@ func FetchAndLoadBundles(ctx context.Context, bs blockstore.Blockstore, bar map[
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
case bd.Path != "":
|
case bd.Path[netw] != "":
|
||||||
if _, err := LoadBundle(ctx, bs, bd.Path, av); err != nil {
|
if _, err := LoadBundle(ctx, bs, bd.Path[netw], av); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
case bd.URL != "":
|
case bd.URL[netw].URL != "":
|
||||||
if _, err := FetchAndLoadBundleFromURL(ctx, path, bs, av, bd.Release, netw, bd.URL, bd.Checksum); err != nil {
|
if _, err := FetchAndLoadBundleFromURL(ctx, path, bs, av, bd.Release, netw, bd.URL[netw].URL, bd.URL[netw].Checksum); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package modules
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
@ -79,16 +78,16 @@ func LoadBuiltinActors(lc fx.Lifecycle, mctx helpers.MetricsCtx, r repo.LockedRe
|
|||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
case bd.Path != "":
|
case bd.Path[netw] != "":
|
||||||
// this is a local bundle, load it directly from the filessystem
|
// this is a local bundle, load it directly from the filessystem
|
||||||
mfCid, err = bundle.LoadBundle(ctx, bs, bd.Path, av)
|
mfCid, err = bundle.LoadBundle(ctx, bs, bd.Path[netw], av)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
case bd.URL != "":
|
case bd.URL[netw].URL != "":
|
||||||
// fetch it from the specified URL
|
// fetch it from the specified URL
|
||||||
mfCid, err = bundle.FetchAndLoadBundleFromURL(ctx, r.Path(), bs, av, bd.Release, netw, bd.URL, bd.Checksum)
|
mfCid, err = bundle.FetchAndLoadBundleFromURL(ctx, r.Path(), bs, av, bd.Release, netw, bd.URL[netw].URL, bd.URL[netw].Checksum)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
@ -140,18 +139,21 @@ func LoadBuiltinActorsTesting(lc fx.Lifecycle, mctx helpers.MetricsCtx, bs dtype
|
|||||||
testingBundleMx.Lock()
|
testingBundleMx.Lock()
|
||||||
defer testingBundleMx.Unlock()
|
defer testingBundleMx.Unlock()
|
||||||
|
|
||||||
|
const basePath = "/tmp/lotus-testing"
|
||||||
for av, bd := range build.BuiltinActorReleases {
|
for av, bd := range build.BuiltinActorReleases {
|
||||||
switch {
|
switch {
|
||||||
case bd.Path != "":
|
case bd.Path[netw] != "":
|
||||||
// we need the appropriate bundle for tests; it should live next to the main bundle, with the
|
if _, err := bundle.LoadBundle(ctx, bs, bd.Path[netw], av); err != nil {
|
||||||
// appropriate network name
|
|
||||||
path := filepath.Join(filepath.Dir(bd.Path), fmt.Sprintf("builtin-actors-%s.car", netw))
|
|
||||||
if _, err := bundle.LoadBundle(ctx, bs, path, av); err != nil {
|
|
||||||
return result, xerrors.Errorf("error loading testing bundle for builtin-actors version %d/%s: %w", av, netw, err)
|
return result, xerrors.Errorf("error loading testing bundle for builtin-actors version %d/%s: %w", av, netw, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case bd.URL[netw].URL != "":
|
||||||
|
// fetch it from the specified URL
|
||||||
|
if _, err := bundle.FetchAndLoadBundleFromURL(ctx, basePath, bs, av, bd.Release, netw, bd.URL[netw].URL, bd.URL[netw].Checksum); err != nil {
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
|
|
||||||
case bd.Release != "":
|
case bd.Release != "":
|
||||||
const basePath = "/tmp/lotus-testing"
|
|
||||||
if _, err := bundle.FetchAndLoadBundleFromRelease(ctx, basePath, bs, av, bd.Release, netw); err != nil {
|
if _, err := bundle.FetchAndLoadBundleFromRelease(ctx, basePath, bs, av, bd.Release, netw); err != nil {
|
||||||
return result, xerrors.Errorf("error loading testing bundle for builtin-actors version %d/%s: %w", av, netw, err)
|
return result, xerrors.Errorf("error loading testing bundle for builtin-actors version %d/%s: %w", av, netw, err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user