gaeemulation

package
v0.0.0-...-d3da680 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 25 Imported by: 16

Documentation

Overview

Package gaeemulation provides a server module that adds implementation of some https://godoc.org/go.chromium.org/luci/gae APIs to the global server context.

The implementation is based on regular Cloud APIs and works from anywhere (not necessarily from Appengine).

Usage:

func main() {
  modules := []module.Module{
    gaeemulation.NewModuleFromFlags(),
  }
  server.Main(nil, modules, func(srv *server.Server) error {
    srv.Routes.GET("/", ..., func(c *router.Context) {
      ent := Entity{ID: "..."}
      err := datastore.Get(c.Context, &ent)
      ...
    })
    return nil
  })
}

TODO(vadimsh): Currently provides datastore API only.

Index

Constants

This section is empty.

Variables

View Source
var ModuleName = module.RegisterName("go.chromium.org/luci/server/gaeemulation")

ModuleName can be used to refer to this module when declaring dependencies.

Functions

func NewModule

func NewModule(opts *ModuleOptions) module.Module

NewModule returns a server module that adds implementation of some https://godoc.org/go.chromium.org/luci/gae APIs to the global server context.

func NewModuleFromFlags

func NewModuleFromFlags() module.Module

NewModuleFromFlags is a variant of NewModule that initializes options through command line flags.

Calling this function registers flags in flag.CommandLine. They are usually parsed in server.Main(...).

Types

type ModuleOptions

type ModuleOptions struct {
	DSCache                  string // currently either "disable" (default) or "redis"
	RandomSecretsInDatastore bool   // true to replace the random secrets store with the GAEv1-one
	DSConnectionPoolSize     int    // passed to WithGRPCConnectionPool, if > 0.
}

ModuleOptions contain configuration of the GAE Emulation server module

func (*ModuleOptions) Register

func (o *ModuleOptions) Register(f *flag.FlagSet)

Register registers the command line flags.

Jump to

Keyboard shortcuts

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