providercache

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: 19 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 {
	Providers mtimesyncedcache.Map[string, *Spaces]
	// contains filtered or unexported fields
}

Cache holds share information structured by provider and space

func New

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

New returns a new Cache instance

func (*Cache) Add

func (c *Cache) Add(ctx context.Context, storageID, spaceID, shareID string, share *collaboration.Share) error

Add adds a share to the cache

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, storageID, spaceID, shareID string, skipSync bool) (*collaboration.Share, error)

Get returns one entry from the cache

func (*Cache) ListSpace

func (c *Cache) ListSpace(ctx context.Context, storageID, spaceID string) (*Shares, error)

ListSpace returns the list of shares in a given space

func (*Cache) LockSpace added in v2.15.0

func (c *Cache) LockSpace(spaceID string) func()

LockSpace locks the cache for a given space and returns an unlock function

func (*Cache) Persist

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

Persist persists the data of one space

func (*Cache) Remove

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

Remove removes a share from the cache

type Shares

type Shares struct {
	Shares map[string]*collaboration.Share

	Etag string
}

Shares holds the share information of one space

func (*Shares) UnmarshalJSON

func (s *Shares) UnmarshalJSON(data []byte) error

UnmarshalJSON overrides the default unmarshaling Shares are tricky to unmarshal because they contain an interface (Grantee) which makes the json Unmarshal bail out To work around that problem we unmarshal into json.RawMessage in a first step and then try to manually unmarshal into the specific types in a second step.

type Spaces

type Spaces struct {
	Spaces mtimesyncedcache.Map[string, *Shares]
}

Spaces holds the share information for provider

Jump to

Keyboard shortcuts

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