admin

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventNameKey    = "eventName"
	EventRawDataKey = "rawEvent"
)
View Source
const (
	EventStreamRegistryModified = "stream_registry_modified"
)

Admin event and operation types.

View Source
const (
	OperationStreamRegistration = "streamRegistration"
)

Variables

View Source
var AdminEventSpec = []byte(`
{
   "namespace": "geist",
   "streamIdSuffix": "adminevents",
   "description": "A built-in GEIST-internal admin notification stream. For example, when a new or updated spec is written to Registry db, Registry sends an event to pubsub, which are listened to by all GEIST deployments. This in turn makes Registries, not yet synchronized, load the new specs from db.",
   "version": 1,
   "source": {
      "type": "pubsub",
      "config": {
         "topics": [
            {
               "env": "all",
               "names": [
                  "geist-admin-events"
               ]
            }
         ],
         "subscription": {
            "type": "unique"
         }
      }
   },
   "transform": {
      "extractFields": [
         {
            "fields": [
               {
                  "id": "eventName",
                  "jsonPath": "name"
               },
               {
                  "id": "rawEvent",
                  "type": "string"
               }
            ]
         }
      ]
   },
   "sink": {
      "type": "admin"
   }
}`)
View Source
var AdminEventSpecInMem = []byte(`
{
   "namespace": "geist",
   "streamIdSuffix": "adminevents-inmem",
   "description": "When running Registry in-mem, there's no point in having cross-pod admin events, so this spec is a bare-bones naked one'",
   "version": 1,
   "source": {
      "type": "geistapi"
   },
   "transform": {
      "extractFields": [
         {
            "fields": [
               {
                  "id": "eventName",
                  "jsonPath": "name"
               },
               {
                  "id": "rawEvent",
                  "type": "string"
               }
            ]
         }
      ]
   },
   "sink": {
      "type": "admin"
   }
}`)
View Source
var SpecRegistrationSpec = []byte(`
{
   "namespace": "geist",
   "streamIdSuffix": "specs",
   "description": "A stream ingestion of GEIST Specs, with source set as GEIST REST API, no Transformation, and into a Firestore Sink (GEIST Registry).",
   "version": 1,
   "source": {
      "type": "geistapi"
   },
   "transform": {
      "extractFields": [
         {
            "fields": [
               {
                  "id": "namespace",
                  "jsonPath": "namespace"
               },
               {
                  "id": "idSuffix",
                  "jsonPath": "streamIdSuffix"
               },
               {
                  "id": "description",
                  "jsonPath": "description"
               },
               {
                  "id": "version",
                  "jsonPath": "version",
                  "type": "integer"
               },
               {
                  "id": "disabled",
                  "jsonPath": "disabled",
                  "type": "bool"
               },
               {
                  "id": "rawEvent",
                  "type": "string"
               }
            ]
         }
      ]
   },
   "sink": {
      "type": "firestore",
      "config": {
         "kinds": [
            {
               "name": "EtlSpec",
               "entityNameFromIds": {
                  "ids": [
                     "namespace",
                     "idSuffix"
                  ],
                  "delimiter": "-"
               },
               "properties": [
                  {
                     "id": "version",
                     "name": "version",
                     "index": true
                  },
                  {
                     "id": "description",
                     "name": "description",
                     "index": false
                  },
                  {
                     "id": "disabled",
                     "name": "disabled",
                     "index": true
                  },
                  {
                     "id": "rawEvent",
                     "name": "specData",
                     "index": false
                  }
               ]
            }
         ]
      }
   }
}`)

SpecRegistrationSpec is the internal, built-in GEIST spec required for handling of GEIST specs themselves. It defines how specs can be received from the chosen Source, and where and how to store them. This spec cannot store itself into that repository for bootstrap reasons. We can have a number of these supported spec registration flows here, and it's up to the GEIST app service init to choose the appropriate one. We can easily change the spec reg flow to have GEIST spec deployments be done by sending specs to pubsub instead. Just switch spec.source.type to "pubsub" and add pubsub topic config.

View Source
var SpecRegistrationSpecInMem = []byte(`
{
   "namespace": "geist",
   "streamIdSuffix": "specs",
   "description": "A stream ingestion of GEIST Specs, with source set as GEIST API, no Transformation, and no sink (specs stored in-memory).",
   "version": 1,
   "source": {
      "type": "geistapi"
   },
   "transform": {
      "extractFields": [
         {
            "fields": [
               {
                  "id": "rawEvent",
                  "type": "string"
               }
            ]
         }
      ]
   },
   "sink": {
      "type": "void",
      "config": {
         "properties": [
            {
               "key": "mode",
               "value": "inMemRegistrySink"
            }
         ]
      }
   }
}`)

SpecRegistrationSpecInMem is the in-mem alternative to SpecRegistrationSpec (see that one for more detailed doc)

Functions

This section is empty.

Types

type AdminEvent

type AdminEvent struct {
	Name         string           `json:"name"`
	DateOccurred time.Time        `json:"dateOccurred"`
	Version      string           `json:"version"`
	EventId      string           `json:"eventId"`
	Location     Location         `json:"location"`
	Data         []AdminEventData `json:"data"`
}

func NewAdminEvent

func NewAdminEvent(name string, operation string, streamId string) AdminEvent

type AdminEventData

type AdminEventData struct {
	Operation string `json:"operation,omitempty"`
	StreamId  string `json:"streamId,omitempty"`
}

type ChanEvent

type ChanEvent struct {
	Event         any // TODO: change to []byte
	ResultChannel chan ResultChanEvent
}

type EventChannel

type EventChannel chan ChanEvent

type Location

type Location struct {
	Service string `json:"service"`
}

type RegStorageMode

type RegStorageMode string
const (
	RegStorageUndefined RegStorageMode = ""
	RegStorageNative    RegStorageMode = "native"
	RegStorageInMemory  RegStorageMode = "inmemory"
	RegStorageCustom    RegStorageMode = "custom"
)

type ResultChanEvent

type ResultChanEvent struct {
	Id      string // Id of published event (created resource), according to rules in ETL stream spec
	Success bool   // Result status that will only be true if set explicitly, avoiding default value issues with Err
	Error   error  // Contains error info in case of Success == false
}

type ResultChannel

type ResultChannel <-chan ResultChanEvent

Jump to

Keyboard shortcuts

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