gae: go.chromium.org/gae/filter/readonly Index | Files

package readonly

import "go.chromium.org/gae/filter/readonly"

Package readonly implements a filter that enforces read-only accesses to services.

This can be useful in hybrid environments where one cluster wants to read from a cache-backed datastore, but cannot modify the cache, so reads are safe and direct, but writes would create a state where the cached values are invalid.

This happens when mixing AppEngine datastore/memcache with Cloud Datastore readers.

Package readonly implements a filter that enforces read-only accesses to datastore.

This is useful in hybrid environments where one cluster wants to read from a cache-backed datastore, but cannot modify the cache, so reads are safe and direct, but writes would create a state where the cached values are invalid. This happens when mixing AppEngine datastore/memcache with Cloud Datastore readers.

Index

Package Files

filter.go rds.go

Variables

var ErrReadOnly = errors.New("readonly: datastore is read-only")

ErrReadOnly is an error returned in response to mutating datastore operations.

func FilterRDS Uses

func FilterRDS(c context.Context, p Predicate) context.Context

FilterRDS installs a read-only datastore filter in the context.

This enforces that mutating datastore operations that touch keys for which the predicate returns 'true' fail with ErrReadOnly.

If the predicate is nil, all mutating operations are denied.

type Predicate Uses

type Predicate func(*ds.Key) (isReadOnly bool)

Predicate is a user-supplied function that examines a key and returns true if it should be treated as read-only.

Package readonly imports 3 packages (graph) and is imported by 2 packages. Updated 2018-09-15. Refresh now. Tools for package owners.