luci: Index | Examples | Files

package count

import ""

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



Package Files

count.go gi.go mail.go mc.go mod.go rds.go tq.go user.go

type DSCounter Uses

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 Uses

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

FilterRDS installs a counter datastore filter in the context.


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

// Using the other function.

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



type Entry Uses

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 Uses

func (e *Entry) Errors() int

Errors returns the number of unsuccessful invocations for this Entry.

func (*Entry) String Uses

func (e *Entry) String() string

func (*Entry) Successes Uses

func (e *Entry) Successes() int

Successes returns the number of successful invocations for this Entry.

func (*Entry) Total Uses

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 Uses

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 Uses

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

FilterGI installs a counter GlobalInfo filter in the context.

type MCCounter Uses

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 Uses

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

FilterMC installs a counter Memcache filter in the context.

type MailCounter Uses

type MailCounter struct {
    Send         Entry
    SendToAdmins Entry

MailCounter is the counter object for the Mail service.

func FilterMail Uses

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

FilterMail installs a counter Mail filter in the context.

type ModuleCounter Uses

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 Uses

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

FilterModule installs a counter Module filter in the context.

type TQCounter Uses

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 Uses

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

FilterTQ installs a counter TaskQueue filter in the context.

type UserCounter Uses

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 Uses

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

FilterUser installs a counter User filter in the context.

Package count imports 11 packages (graph). Updated 2021-01-23. Refresh now. Tools for package owners.