[ARVADOS] updated: 2.1.0-1509-g0bf2509a1
Git user
git at public.arvados.org
Fri Oct 29 17:20:12 UTC 2021
Summary of changes:
lib/config/load.go | 24 ++++++++++++++----------
sdk/go/arvados/config.go | 36 +++++++++++++++++++-----------------
2 files changed, 33 insertions(+), 27 deletions(-)
via 0bf2509a1030e1b2ee0a575fdf1ff69467152dce (commit)
from 92514990f5f2698332c237fef954a63e89ab8f75 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 0bf2509a1030e1b2ee0a575fdf1ff69467152dce
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date: Fri Oct 29 14:17:53 2021 -0300
17944: Refactors vocabulary file loader.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>
diff --git a/lib/config/load.go b/lib/config/load.go
index 8462aa6e8..684d7bbe6 100644
--- a/lib/config/load.go
+++ b/lib/config/load.go
@@ -403,36 +403,40 @@ func (ldr *Loader) loadVocabulary(cfg *arvados.Config) error {
return nil
}
ldr.Logger.Info("Loading vocabulary")
- err = ldr.vocabularyFileLoader(cc)
+ voc, err := ldr.vocabularyFileLoader(cc.API.VocabularyPath, cc.Collections.ManagedProperties)
if err != nil {
return err
}
+ cc.API.Vocabulary = voc
+
go watchVocabulary(ldr.Logger, cc.API.VocabularyPath, func() {
ldr.Logger.Info("Reloading vocabulary")
- err = ldr.vocabularyFileLoader(cc)
+ voc, err := ldr.vocabularyFileLoader(cc.API.VocabularyPath, cc.Collections.ManagedProperties)
if err != nil {
ldr.Logger.Error("Error reloading vocabulary: %v", err)
}
+ cc.API.Vocabulary = voc
})
+
return nil
}
-func (ldr *Loader) vocabularyFileLoader(cc *arvados.Cluster) error {
- vf, err := os.ReadFile(cc.API.VocabularyPath)
+func (ldr *Loader) vocabularyFileLoader(path string, mp arvados.ManagedProperties) (*arvados.Vocabulary, error) {
+ vf, err := os.ReadFile(path)
if err != nil {
- return fmt.Errorf("couldn't read vocabulary file %q: %v", cc.API.VocabularyPath, err)
+ return nil, fmt.Errorf("couldn't read vocabulary file %q: %v", path, err)
}
- mk := make([]string, 0, len(cc.Collections.ManagedProperties))
- for k := range cc.Collections.ManagedProperties {
+ // Managed properties' keys loading
+ mk := make([]string, 0, len(mp))
+ for k := range mp {
mk = append(mk, k)
}
voc, err := arvados.NewVocabulary(vf, mk)
if err != nil {
- return fmt.Errorf("while loading vocabulary file %q: %s", cc.API.VocabularyPath, err)
+ return nil, fmt.Errorf("while loading vocabulary file %q: %s", path, err)
}
- cc.API.Vocabulary = voc
ldr.Logger.Info("Vocabulary loading succeeded")
- return nil
+ return voc, nil
}
func watchVocabulary(logger logrus.FieldLogger, vocPath string, fn func()) {
diff --git a/sdk/go/arvados/config.go b/sdk/go/arvados/config.go
index 50babd5f3..87b71bfbe 100644
--- a/sdk/go/arvados/config.go
+++ b/sdk/go/arvados/config.go
@@ -77,6 +77,12 @@ type UploadDownloadRolePermissions struct {
Admin UploadDownloadPermission
}
+type ManagedProperties map[string]struct {
+ Value interface{}
+ Function string
+ Protected bool
+}
+
type Cluster struct {
ClusterID string `json:"-"`
ManagementToken string
@@ -111,23 +117,19 @@ type Cluster struct {
UnloggedAttributes StringSet
}
Collections struct {
- BlobSigning bool
- BlobSigningKey string
- BlobSigningTTL Duration
- BlobTrash bool
- BlobTrashLifetime Duration
- BlobTrashCheckInterval Duration
- BlobTrashConcurrency int
- BlobDeleteConcurrency int
- BlobReplicateConcurrency int
- CollectionVersioning bool
- DefaultTrashLifetime Duration
- DefaultReplication int
- ManagedProperties map[string]struct {
- Value interface{}
- Function string
- Protected bool
- }
+ BlobSigning bool
+ BlobSigningKey string
+ BlobSigningTTL Duration
+ BlobTrash bool
+ BlobTrashLifetime Duration
+ BlobTrashCheckInterval Duration
+ BlobTrashConcurrency int
+ BlobDeleteConcurrency int
+ BlobReplicateConcurrency int
+ CollectionVersioning bool
+ DefaultTrashLifetime Duration
+ DefaultReplication int
+ ManagedProperties ManagedProperties
PreserveVersionIfIdle Duration
TrashSweepInterval Duration
TrustAllContent bool
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list