count

package
v0.0.0-...-8b7da69 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package count contains 'counter' filters for all the gae services. This serves as a set of simple example filters, and also enables other filters to test to see if certain underlying APIs are called when they should be (e.g. for the datastore mcache filter, for example).

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DSCounter

type DSCounter struct {
	AllocateIDs      Entry
	DecodeCursor     Entry
	RunInTransaction Entry
	Run              Entry
	Count            Entry
	DeleteMulti      Entry
	GetMulti         Entry
	PutMulti         Entry
}

DSCounter is the counter object for the datastore service.

func FilterRDS

func FilterRDS(c context.Context) (context.Context, *DSCounter)

FilterRDS installs a counter datastore filter in the context.

Example
// Set up your context using a base service implementation (memory or prod)
c := memory.Use(context.Background())

// Apply the counter.FilterRDS
c, counter := FilterRDS(c)

// functions use ds from the context like normal... they don't need to know
// that there are any filters at all.
someCalledFunc := func(c context.Context) {
	vals := []ds.PropertyMap{{
		"FieldName": ds.MkProperty(100),
		"$key":      ds.MkProperty(ds.NewKey(c, "Kind", "", 1, nil))},
	}
	if err := ds.Put(c, vals); err != nil {
		panic(err)
	}
}

// Using the other function.
someCalledFunc(c)
someCalledFunc(c)

// Then we can see what happened!
fmt.Printf("%d\n", counter.PutMulti.Successes())
Output:

2

type Entry

type Entry struct {
	// contains filtered or unexported fields
}

Entry is a success/fail pair for a single API method. It's returned by the Counter interface.

func (*Entry) Errors

func (e *Entry) Errors() int

Errors returns the number of unsuccessful invocations for this Entry.

func (*Entry) String

func (e *Entry) String() string

func (*Entry) Successes

func (e *Entry) Successes() int

Successes returns the number of successful invocations for this Entry.

func (*Entry) Total

func (e *Entry) Total() int64

Total is a convenience function for getting the total number of calls to this API. It's Successes+Errors.

type InfoCounter

type InfoCounter struct {
	AppID                  Entry
	FullyQualifiedAppID    Entry
	GetNamespace           Entry
	Datacenter             Entry
	DefaultVersionHostname Entry
	InstanceID             Entry
	IsDevAppServer         Entry
	IsOverQuota            Entry
	IsTimeoutError         Entry
	ModuleHostname         Entry
	ModuleName             Entry
	RequestID              Entry
	ServerSoftware         Entry
	ServiceAccount         Entry
	VersionID              Entry
	Namespace              Entry
	AccessToken            Entry
	PublicCertificates     Entry
	SignBytes              Entry
}

InfoCounter is the counter object for the GlobalInfo service.

func FilterGI

func FilterGI(c context.Context) (context.Context, *InfoCounter)

FilterGI installs a counter GlobalInfo filter in the context.

type MCCounter

type MCCounter struct {
	NewItem             Entry
	AddMulti            Entry
	SetMulti            Entry
	GetMulti            Entry
	DeleteMulti         Entry
	CompareAndSwapMulti Entry
	Increment           Entry
	Flush               Entry
	Stats               Entry
}

MCCounter is the counter object for the Memcache service.

func FilterMC

func FilterMC(c context.Context) (context.Context, *MCCounter)

FilterMC installs a counter Memcache filter in the context.

type MailCounter

type MailCounter struct {
	Send         Entry
	SendToAdmins Entry
}

MailCounter is the counter object for the Mail service.

func FilterMail

func FilterMail(c context.Context) (context.Context, *MailCounter)

FilterMail installs a counter Mail filter in the context.

type ModuleCounter

type ModuleCounter struct {
	List            Entry
	NumInstances    Entry
	SetNumInstances Entry
	Versions        Entry
	DefaultVersion  Entry
	Start           Entry
	Stop            Entry
}

ModuleCounter is the counter object for the Module service.

func FilterModule

func FilterModule(c context.Context) (context.Context, *ModuleCounter)

FilterModule installs a counter Module filter in the context.

type TQCounter

type TQCounter struct {
	AddMulti    Entry
	DeleteMulti Entry
	Lease       Entry
	LeaseByTag  Entry
	ModifyLease Entry
	Purge       Entry
	Stats       Entry
}

TQCounter is the counter object for the TaskQueue service.

func FilterTQ

func FilterTQ(c context.Context) (context.Context, *TQCounter)

FilterTQ installs a counter TaskQueue filter in the context.

type UserCounter

type UserCounter struct {
	Current           Entry
	CurrentOAuth      Entry
	IsAdmin           Entry
	LoginURL          Entry
	LoginURLFederated Entry
	LogoutURL         Entry
	OAuthConsumerKey  Entry
}

UserCounter is the counter object for the User service.

func FilterUser

func FilterUser(c context.Context) (context.Context, *UserCounter)

FilterUser installs a counter User filter in the context.

Jump to

Keyboard shortcuts

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