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 string
|
||||
// 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 string
|
||||
// CHecksum is the bundle sha256 checksume in hex, when specifying a URL.
|
||||
Checksum string
|
||||
URL map[string]BundleURL
|
||||
// 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
|
||||
// datastore.
|
||||
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
|
||||
}
|
||||
|
||||
case bd.Path != "":
|
||||
if _, err := LoadBundle(ctx, bs, bd.Path, av); err != nil {
|
||||
case bd.Path[netw] != "":
|
||||
if _, err := LoadBundle(ctx, bs, bd.Path[netw], av); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
case bd.URL != "":
|
||||
if _, err := FetchAndLoadBundleFromURL(ctx, path, bs, av, bd.Release, netw, bd.URL, bd.Checksum); err != nil {
|
||||
case bd.URL[netw].URL != "":
|
||||
if _, err := FetchAndLoadBundleFromURL(ctx, path, bs, av, bd.Release, netw, bd.URL[netw].URL, bd.URL[netw].Checksum); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package modules
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"go.uber.org/fx"
|
||||
@ -79,16 +78,16 @@ func LoadBuiltinActors(lc fx.Lifecycle, mctx helpers.MetricsCtx, r repo.LockedRe
|
||||
return result, err
|
||||
}
|
||||
|
||||
case bd.Path != "":
|
||||
case bd.Path[netw] != "":
|
||||
// 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 {
|
||||
return result, err
|
||||
}
|
||||
|
||||
case bd.URL != "":
|
||||
case bd.URL[netw].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 {
|
||||
return result, err
|
||||
}
|
||||
@ -140,18 +139,21 @@ func LoadBuiltinActorsTesting(lc fx.Lifecycle, mctx helpers.MetricsCtx, bs dtype
|
||||
testingBundleMx.Lock()
|
||||
defer testingBundleMx.Unlock()
|
||||
|
||||
const basePath = "/tmp/lotus-testing"
|
||||
for av, bd := range build.BuiltinActorReleases {
|
||||
switch {
|
||||
case bd.Path != "":
|
||||
// we need the appropriate bundle for tests; it should live next to the main bundle, with the
|
||||
// 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 {
|
||||
case bd.Path[netw] != "":
|
||||
if _, err := bundle.LoadBundle(ctx, bs, bd.Path[netw], av); err != nil {
|
||||
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 != "":
|
||||
const basePath = "/tmp/lotus-testing"
|
||||
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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user