providercache

package
v2.13.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 13 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 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(storageID, spaceID, shareID string) *collaboration.Share

Get returns one entry from the cache

func (*Cache) ListSpace

func (c *Cache) ListSpace(storageID, spaceID string) *Shares

ListSpace returns the list of shares in a given space

func (*Cache) Persist

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

Persist persists the data of one space

func (*Cache) PersistWithTime

func (c *Cache) PersistWithTime(ctx context.Context, storageID, spaceID string, mtime time.Time) error

PersistWithTime persists the data of one space if it has not been modified since the given mtime

func (*Cache) Remove

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

Remove removes a share from the cache

func (*Cache) Sync

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

Sync updates the in-memory data with the data from the storage if it is outdated

type Shares

type Shares struct {
	Shares map[string]*collaboration.Share
	Mtime  time.Time
	// contains filtered or unexported fields
}

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 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