v0

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: Apache-2.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewACLServer

func NewACLServer(ds datastore.Datastore, nsm namespace.Manager, dispatch dispatch.Dispatcher, defaultDepth uint32) v0.ACLServiceServer

NewACLServer creates an instance of the ACL server.

func NewDeveloperServer

func NewDeveloperServer(store ShareStore) v0.DeveloperServiceServer

NewDeveloperServer creates an instance of the developer server.

func NewHTTPDownloadServer added in v1.2.0

func NewHTTPDownloadServer(addr string, shareStore ShareStore) *http.Server

func NewNamespaceServer

func NewNamespaceServer(ds datastore.Datastore) v0.NamespaceServiceServer

NewNamespaceServer creates an instance of the namespace server.

func NewWatchServer

func NewWatchServer(ds datastore.Datastore, nsm namespace.Manager) v0.WatchServiceServer

NewWatchServer creates an instance of the watch server.

func RegisterDeveloperServer added in v0.0.2

func RegisterDeveloperServer(r grpc.ServiceRegistrar, s v0.DeveloperServiceServer) *grpc.ServiceDesc

RegisterDeveloperServer adds the Developer Server to a grpc service registrar This is preferred over manually registering the service; it will add required middleware

Types

type DevContext

type DevContext struct {
	Ctx              context.Context
	Datastore        datastore.Datastore
	Revision         decimal.Decimal
	Namespaces       []*v0.NamespaceDefinition
	Dispatcher       dispatch.Dispatcher
	RequestErrors    []*v0.DeveloperError
	NamespaceManager namespace.Manager
}

DevContext holds the various helper types for running the developer calls.

func NewDevContext

func NewDevContext(ctx context.Context, requestContext *v0.RequestContext) (*DevContext, bool, error)

NewDevContext creates a new DevContext from the specified request context, parsing and populating the datastore as needed.

type LookupStatus

type LookupStatus int

LookupStatus is an enum for the possible ShareStore lookup outcomes.

const (
	// LookupError indicates an error has occurred.
	LookupError LookupStatus = iota

	// LookupNotFound indicates that no results were found for the specified reference.
	LookupNotFound

	// LookupSuccess indicates success.
	LookupSuccess

	// LookupConverted indicates when the results have been converted from an earlier version.
	LookupConverted
)

type ShareStore

type ShareStore interface {
	// LookupSharedByReference returns the shared data for the given reference hash, if any.
	LookupSharedByReference(reference string) (SharedDataV2, LookupStatus, error)

	// StoreShared stores the given shared playground data in the backing storage, and returns
	// its reference hash.
	StoreShared(data SharedDataV2) (string, error)
}

ShareStore defines the interface for sharing and loading shared playground files.

func NewInMemoryShareStore

func NewInMemoryShareStore(salt string) ShareStore

NewInMemoryShareStore creates a new in memory share store.

func NewS3ShareStore

func NewS3ShareStore(bucket string, salt string, config *aws.Config) (ShareStore, error)

NewS3ShareStore creates a new S3 share store, reading and writing the shared data to the given bucket, with the given salt for hash computation and the given config for connecting to S3 or and S3-compatible API.

type SharedDataV1

type SharedDataV1 struct {
	Version          string   `json:"version"`
	NamespaceConfigs []string `json:"namespace_configs"`
	RelationTuples   string   `json:"relation_tuples"`
	ValidationYaml   string   `json:"validation_yaml"`
	AssertionsYaml   string   `json:"assertions_yaml"`
}

SharedDataV1 represents the data stored in a shared playground file.

type SharedDataV2

type SharedDataV2 struct {
	Version           string `json:"version" yaml:"-"`
	Schema            string `json:"schema" yaml:"schema"`
	RelationshipsYaml string `json:"relationships_yaml" yaml:"relationships"`
	ValidationYaml    string `json:"validation_yaml" yaml:"validation"`
	AssertionsYaml    string `json:"assertions_yaml" yaml:"assertions"`
}

SharedDataV2 represents the data stored in a shared playground file.

Jump to

Keyboard shortcuts

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