mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-18 11:28:48 -06:00
@@ -1921,7 +1921,6 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on =
|
||||
"MICRO_REGISTRY_ADDRESS": "127.0.0.1:9233",
|
||||
"OCIS_CACHE_STORE": "nats-js-kv",
|
||||
"OCIS_CACHE_STORE_NODES": "127.0.0.1:9233",
|
||||
"OCIS_CACHE_DATABASE": "cache",
|
||||
}
|
||||
|
||||
if deploy_type == "":
|
||||
|
||||
5
changelog/unreleased/bump-reva.md
Normal file
5
changelog/unreleased/bump-reva.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Enhancement: Bump reva
|
||||
|
||||
Bumps reva version
|
||||
|
||||
https://github.com/owncloud/ocis/pull/7793
|
||||
4
go.mod
4
go.mod
@@ -35,7 +35,7 @@ require (
|
||||
github.com/go-micro/plugins/v4/registry/nats v1.2.2-0.20230723205323-1ada01245674
|
||||
github.com/go-micro/plugins/v4/server/grpc v1.2.0
|
||||
github.com/go-micro/plugins/v4/server/http v1.2.2
|
||||
github.com/go-micro/plugins/v4/store/nats-js v1.2.1-0.20230807070816-bc05fb076ce7
|
||||
github.com/go-micro/plugins/v4/store/nats-js v1.2.1-0.20231129143103-d72facc652f0
|
||||
github.com/go-micro/plugins/v4/wrapper/breaker/gobreaker v1.2.0
|
||||
github.com/go-micro/plugins/v4/wrapper/monitoring/prometheus v1.2.0
|
||||
github.com/go-micro/plugins/v4/wrapper/trace/opentelemetry v1.2.0
|
||||
@@ -347,6 +347,4 @@ require (
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
replace github.com/go-micro/plugins/v4/store/nats-js => github.com/kobergj/plugins/v4/store/nats-js v1.2.1-0.20231020092801-9463c820c19a
|
||||
|
||||
replace github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20231207143248-4d424e3ae348
|
||||
|
||||
4
go.sum
4
go.sum
@@ -1213,6 +1213,8 @@ github.com/go-micro/plugins/v4/server/grpc v1.2.0 h1:lXfM+/0oE/u1g0hVBYsvbP4lYOY
|
||||
github.com/go-micro/plugins/v4/server/grpc v1.2.0/go.mod h1:+Ah9Pf/vMSXxBM3fup/hc3N+zN2as3nIpcRaR4sBjnY=
|
||||
github.com/go-micro/plugins/v4/server/http v1.2.2 h1:UK2/09AU0zV3wHELuR72TZzVU2vTUhbx9qrRGrQSIWg=
|
||||
github.com/go-micro/plugins/v4/server/http v1.2.2/go.mod h1:YuAjaSPxcn3LI8j2FUsqx0Rxunrj4YwDV41Ax76rLl0=
|
||||
github.com/go-micro/plugins/v4/store/nats-js v1.2.1-0.20231129143103-d72facc652f0 h1:Qa1EBQ9UyCGecFAJQovl/MHGnvbcvDaM3qUoAG5Lnvk=
|
||||
github.com/go-micro/plugins/v4/store/nats-js v1.2.1-0.20231129143103-d72facc652f0/go.mod h1:aCRl8JQmqIaonOl88nFPY/BOQnHPVHY9ngStzLkXnYk=
|
||||
github.com/go-micro/plugins/v4/store/redis v1.2.1-0.20230510195111-07cd57e1bc9d h1:HQoDDVyMfdkrgXNo03ZY4vzhoOXMDZVZ4SnpBDVID6E=
|
||||
github.com/go-micro/plugins/v4/store/redis v1.2.1-0.20230510195111-07cd57e1bc9d/go.mod h1:MbCG0YiyPqETTtm7uHFmxQNCaW1o9hBoYtFwhbVjLUg=
|
||||
github.com/go-micro/plugins/v4/transport/grpc v1.1.0 h1:mXfDYfFQLnVDzjGY3o84oe4prfux9h8txsnA19dKsj8=
|
||||
@@ -1593,8 +1595,6 @@ github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.1.0 h1:eyi1Ad2aNJMW95zcSbmGg7Cg6cq3ADwLpMAP96d8rF0=
|
||||
github.com/klauspost/cpuid/v2 v2.1.0/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
||||
github.com/kobergj/plugins/v4/store/nats-js v1.2.1-0.20231020092801-9463c820c19a h1:W+itvdTLFGLuFh+E5IzW08n2BS02cHK91qnMo7SUxbA=
|
||||
github.com/kobergj/plugins/v4/store/nats-js v1.2.1-0.20231020092801-9463c820c19a/go.mod h1:wt51O2yNmgF/F7E00IYIH0awseRGqtnmjZGn6RjbZSk=
|
||||
github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20231207143248-4d424e3ae348 h1:Czv6AW9Suj6npWd5BLZjobdD78c2RdzBeKBgkq3jYZk=
|
||||
github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20231207143248-4d424e3ae348/go.mod h1:Goi4eJ9SrKkxE6NsAVqBVNxfQFbwb7UbyII6743ldgM=
|
||||
github.com/kolo/xmlrpc v0.0.0-20200310150728-e0350524596b/go.mod h1:o03bZfuBwAXHetKXuInt4S7omeXUu62/A845kiycsSQ=
|
||||
|
||||
@@ -111,8 +111,8 @@ func DefaultConfig() *config.Config {
|
||||
SharePrefix: "/Shares",
|
||||
HomeNamespace: "/users/{{.Id.OpaqueId}}",
|
||||
AdditionalInfoAttribute: "{{.Mail}}",
|
||||
StatCacheType: "noop",
|
||||
StatCacheDatabase: "ocis",
|
||||
StatCacheType: "nats-js-kv",
|
||||
StatCacheDatabase: "cache-stat",
|
||||
StatCacheTTL: 300 * time.Second,
|
||||
ListOCMShares: true,
|
||||
PublicShareMustHavePassword: true,
|
||||
|
||||
@@ -90,7 +90,7 @@ type Cache struct {
|
||||
StatCacheDatabase string `yaml:"stat_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."`
|
||||
StatCacheTTL time.Duration `yaml:"stat_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_STAT_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."`
|
||||
StatCacheSize int `yaml:"stat_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_STAT_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default."`
|
||||
ProviderCacheStore string `yaml:"provider_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_PROVIDER_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'ocmem', 'etcd', 'redis', 'redis-sentinel', 'nats-js', 'noop'. See the text description for details."`
|
||||
ProviderCacheStore string // `yaml:"provider_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_PROVIDER_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'ocmem', 'etcd', 'redis', 'redis-sentinel', 'nats-js', 'noop'. See the text description for details."`
|
||||
ProviderCacheNodes []string `yaml:"provider_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_PROVIDER_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details."`
|
||||
ProviderCacheDatabase string `yaml:"provider_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."`
|
||||
ProviderCacheTTL time.Duration `yaml:"provider_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_PROVIDER_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."`
|
||||
|
||||
@@ -39,14 +39,14 @@ func DefaultConfig() *config.Config {
|
||||
DisableHomeCreationOnLogin: true,
|
||||
TransferExpires: 24 * 60 * 60,
|
||||
Cache: config.Cache{
|
||||
StatCacheStore: "noop",
|
||||
StatCacheStore: "noop", // NOTE: stat cache not working
|
||||
StatCacheDatabase: "ocis",
|
||||
StatCacheTTL: 300 * time.Second,
|
||||
ProviderCacheStore: "noop",
|
||||
ProviderCacheDatabase: "ocis",
|
||||
ProviderCacheDatabase: "cache-providers",
|
||||
ProviderCacheTTL: 300 * time.Second,
|
||||
CreateHomeCacheStore: "noop",
|
||||
CreateHomeCacheDatabase: "ocis",
|
||||
CreateHomeCacheStore: "nats-js-kv",
|
||||
CreateHomeCacheDatabase: "cache-createhome",
|
||||
CreateHomeCacheTTL: 300 * time.Second,
|
||||
},
|
||||
|
||||
|
||||
@@ -96,8 +96,8 @@ func DefaultConfig() *config.Config {
|
||||
},
|
||||
},
|
||||
Cache: &config.Cache{
|
||||
Store: "memory",
|
||||
Database: "ocis",
|
||||
Store: "nats-js-kv",
|
||||
Database: "cache-roles",
|
||||
Table: "roles",
|
||||
TTL: time.Hour * 336,
|
||||
},
|
||||
|
||||
@@ -43,8 +43,8 @@ func DefaultConfig() *config.Config {
|
||||
AccessTokenVerifyMethod: config.AccessTokenVerificationJWT,
|
||||
SkipUserInfo: false,
|
||||
UserinfoCache: &config.Cache{
|
||||
Store: "memory",
|
||||
Database: "ocis",
|
||||
Store: "nats-js-kv",
|
||||
Database: "cache-userinfo",
|
||||
Table: "userinfo",
|
||||
TTL: time.Second * 10,
|
||||
},
|
||||
|
||||
@@ -57,8 +57,8 @@ func DefaultConfig() *config.Config {
|
||||
StorageAddress: "com.owncloud.api.storage-system",
|
||||
SystemUserIDP: "internal",
|
||||
Cache: &config.Cache{
|
||||
Store: "memory",
|
||||
Database: "ocis",
|
||||
Store: "nats-js-kv",
|
||||
Database: "settings-cache",
|
||||
FileTable: "settings_files",
|
||||
DirectoryTable: "settings_dirs",
|
||||
TTL: time.Minute * 10,
|
||||
|
||||
@@ -52,8 +52,8 @@ func DefaultConfig() *config.Config {
|
||||
},
|
||||
},
|
||||
FileMetadataCache: config.Cache{
|
||||
Store: "memory",
|
||||
Database: "ocis",
|
||||
Store: "nats-js-kv",
|
||||
Database: "cache-filemetadata",
|
||||
TTL: 24 * 60 * time.Second,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -99,13 +99,13 @@ func DefaultConfig() *config.Config {
|
||||
TTL: 300 * time.Second,
|
||||
},
|
||||
FilemetadataCache: config.FilemetadataCache{
|
||||
Store: "memory",
|
||||
Database: "ocis",
|
||||
Store: "nats-js-kv",
|
||||
Database: "cache-filemetadata",
|
||||
TTL: 24 * 60 * time.Second,
|
||||
},
|
||||
IDCache: config.IDCache{
|
||||
Store: "nats-js-kv",
|
||||
Database: "ocis",
|
||||
Database: "ids-storage-users",
|
||||
TTL: 24 * 60 * time.Second,
|
||||
},
|
||||
Tasks: config.Tasks{
|
||||
|
||||
@@ -275,7 +275,9 @@ func (MessagePackBackend) IsMetaFile(path string) bool {
|
||||
|
||||
// Purge purges the data of a given path
|
||||
func (b MessagePackBackend) Purge(path string) error {
|
||||
_ = b.metaCache.RemoveMetadata(b.cacheKey(path))
|
||||
if err := b.metaCache.RemoveMetadata(b.cacheKey(path)); err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Remove(b.MetadataPath(path))
|
||||
}
|
||||
|
||||
@@ -289,7 +291,10 @@ func (b MessagePackBackend) Rename(oldPath, newPath string) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
_ = b.metaCache.RemoveMetadata(b.cacheKey(oldPath))
|
||||
err = b.metaCache.RemoveMetadata(b.cacheKey(oldPath))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return os.Rename(b.MetadataPath(oldPath), b.MetadataPath(newPath))
|
||||
}
|
||||
|
||||
30
vendor/github.com/go-micro/plugins/v4/store/nats-js/nats.go
generated
vendored
30
vendor/github.com/go-micro/plugins/v4/store/nats-js/nats.go
generated
vendored
@@ -9,6 +9,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/cornelk/hashmap"
|
||||
"github.com/nats-io/nats.go"
|
||||
"github.com/pkg/errors"
|
||||
"go-micro.dev/v4/store"
|
||||
@@ -34,7 +35,7 @@ type natsStore struct {
|
||||
|
||||
conn *nats.Conn
|
||||
js nats.JetStreamContext
|
||||
buckets *sync.Map
|
||||
buckets *hashmap.Map[string, nats.ObjectStore]
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -55,7 +56,7 @@ func NewStore(opts ...store.Option) store.Store {
|
||||
opts: options,
|
||||
jsopts: []nats.JSOpt{},
|
||||
objStoreConfigs: []*nats.ObjectStoreConfig{},
|
||||
buckets: &sync.Map{},
|
||||
buckets: hashmap.New[string, nats.ObjectStore](),
|
||||
storageType: nats.FileStorage,
|
||||
}
|
||||
|
||||
@@ -103,7 +104,7 @@ func (n *natsStore) Init(opts ...store.Option) error {
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Failed to create bucket (%s)", cfg.Bucket)
|
||||
}
|
||||
n.buckets.Store(cfg.Bucket, store)
|
||||
n.buckets.Set(cfg.Bucket, store)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -178,11 +179,10 @@ func (n *natsStore) Read(key string, opts ...store.ReadOption) ([]*store.Record,
|
||||
opt.Table = n.opts.Table
|
||||
}
|
||||
|
||||
b, ok := n.buckets.Load(opt.Database)
|
||||
bucket, ok := n.buckets.Get(opt.Database)
|
||||
if !ok {
|
||||
return nil, ErrBucketNotFound
|
||||
}
|
||||
bucket := b.(nats.ObjectStore)
|
||||
|
||||
var keys []string
|
||||
|
||||
@@ -292,8 +292,7 @@ func (n *natsStore) Write(r *store.Record, opts ...store.WriteOption) error {
|
||||
opt.Table = n.opts.Table
|
||||
}
|
||||
|
||||
s, ok := n.buckets.Load(opt.Database)
|
||||
store, _ := s.(nats.ObjectStore)
|
||||
store, ok := n.buckets.Get(opt.Database)
|
||||
// Create new bucket if not exists
|
||||
if !ok {
|
||||
var err error
|
||||
@@ -345,19 +344,18 @@ func (n *natsStore) Delete(key string, opts ...store.DeleteOption) error {
|
||||
}
|
||||
|
||||
if opt.Table == "DELETE_BUCKET" {
|
||||
n.buckets.Delete(key)
|
||||
n.buckets.Del(key)
|
||||
if err := n.js.DeleteObjectStore(key); err != nil {
|
||||
return errors.Wrap(err, "Failed to delete bucket")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
s, ok := n.buckets.Load(opt.Database)
|
||||
store, ok := n.buckets.Get(opt.Database)
|
||||
if !ok {
|
||||
return ErrBucketNotFound
|
||||
}
|
||||
|
||||
store := s.(nats.ObjectStore)
|
||||
if err := store.Delete(getKey(key, opt.Table)); err != nil {
|
||||
return errors.Wrap(err, "Failed to delete data")
|
||||
}
|
||||
@@ -383,11 +381,10 @@ func (n *natsStore) List(opts ...store.ListOption) ([]string, error) {
|
||||
opt.Table = n.opts.Table
|
||||
}
|
||||
|
||||
s, ok := n.buckets.Load(opt.Database)
|
||||
store, ok := n.buckets.Get(opt.Database)
|
||||
if !ok {
|
||||
return nil, ErrBucketNotFound
|
||||
}
|
||||
store := s.(nats.ObjectStore)
|
||||
|
||||
objects, err := store.List()
|
||||
if err != nil {
|
||||
@@ -405,13 +402,14 @@ func (n *natsStore) List(opts ...store.ListOption) ([]string, error) {
|
||||
if !strings.HasSuffix(key, opt.Suffix) {
|
||||
continue
|
||||
}
|
||||
keys = append(keys, key)
|
||||
|
||||
keys = append(keys, strings.TrimPrefix(key, getKey(opt.Prefix, opt.Table)))
|
||||
}
|
||||
|
||||
if opt.Limit > 0 {
|
||||
if opt.Limit > 0 && int(opt.Offset+opt.Limit) < len(keys) {
|
||||
return keys[opt.Offset : opt.Offset+opt.Limit], nil
|
||||
}
|
||||
if opt.Offset > 0 {
|
||||
if opt.Offset > 0 && int(opt.Offset) < len(keys) {
|
||||
return keys[opt.Offset:], nil
|
||||
}
|
||||
return keys, nil
|
||||
@@ -448,7 +446,7 @@ func (n *natsStore) createNewBucket(name string) (nats.ObjectStore, error) {
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Failed to create new bucket (%s)", name)
|
||||
}
|
||||
n.buckets.Store(name, store)
|
||||
n.buckets.Set(name, store)
|
||||
return store, err
|
||||
}
|
||||
|
||||
|
||||
5
vendor/modules.txt
vendored
5
vendor/modules.txt
vendored
@@ -937,8 +937,8 @@ github.com/go-micro/plugins/v4/server/grpc
|
||||
# github.com/go-micro/plugins/v4/server/http v1.2.2
|
||||
## explicit; go 1.17
|
||||
github.com/go-micro/plugins/v4/server/http
|
||||
# github.com/go-micro/plugins/v4/store/nats-js v1.2.1-0.20230807070816-bc05fb076ce7 => github.com/kobergj/plugins/v4/store/nats-js v1.2.1-0.20231020092801-9463c820c19a
|
||||
## explicit; go 1.17
|
||||
# github.com/go-micro/plugins/v4/store/nats-js v1.2.1-0.20231129143103-d72facc652f0
|
||||
## explicit; go 1.21
|
||||
github.com/go-micro/plugins/v4/store/nats-js
|
||||
# github.com/go-micro/plugins/v4/store/nats-js-kv v0.0.0-00010101000000-000000000000 => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20231207143248-4d424e3ae348
|
||||
## explicit; go 1.21
|
||||
@@ -2297,5 +2297,4 @@ stash.kopano.io/kgol/oidc-go
|
||||
# stash.kopano.io/kgol/rndm v1.1.2
|
||||
## explicit; go 1.13
|
||||
stash.kopano.io/kgol/rndm
|
||||
# github.com/go-micro/plugins/v4/store/nats-js => github.com/kobergj/plugins/v4/store/nats-js v1.2.1-0.20231020092801-9463c820c19a
|
||||
# github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20231207143248-4d424e3ae348
|
||||
|
||||
Reference in New Issue
Block a user