sharecache

package
v2.19.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	UserShares mtimesyncedcache.Map[string, *UserShareCache]
	// contains filtered or unexported fields
}

Cache caches the list of share ids for users/groups It functions as an in-memory cache with a persistence layer The storage is sharded by user/group

func New

func New(s metadata.Storage, namespace, filename string, ttl time.Duration) Cache

New returns a new Cache instance

func (*Cache) Add

func (c *Cache) Add(ctx context.Context, userid, shareID string) error

Add adds a share to the cache

func (*Cache) List

func (c *Cache) List(ctx context.Context, userid string) (map[string]SpaceShareIDs, error)

List return the list of spaces/shares for the given user/group

func (*Cache) Persist

func (c *Cache) Persist(ctx context.Context, userid string) error

Persist persists the data for one user/group to the storage

func (*Cache) Remove

func (c *Cache) Remove(ctx context.Context, userid, shareID string) error

Remove removes a share for the given user

type SpaceShareIDs

type SpaceShareIDs struct {
	IDs map[string]struct{}
}

SpaceShareIDs holds the unique list of share ids for a space

type UserShareCache

type UserShareCache struct {
	UserShares map[string]*SpaceShareIDs

	Etag string
}

UserShareCache holds the space/share map for one user

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL