Documentation ¶
Overview ¶
Package publish2fs publish assets resource feeds as FireStore documents
It manages creation, updates and delete.
Triggered by ¶
Resource or IAM policies assets feed messages in PubSub topics.
Instances ¶
- one per asset type to be persisted in FireStore.
- ussually 3: organizations, folders and projects.
Output ¶
FireStore documents created, updated, deleted.
Cardinality ¶
One-one, one feed message - one operation performed in FireStore ¶
Automatic retrying ¶
Yes.
Implementation example
package p import ( "context" "github.com/BrunoReboul/ram/services/publish2fs" "github.com/BrunoReboul/ram/utilities/ram" ) var global publish2fs.Global var ctx = context.Background() // EntryPoint is the function to be executed for each cloud function occurence func EntryPoint(ctxEvent context.Context, PubSubMessage ram.PubSubMessage) error { return publish2fs.EntryPoint(ctxEvent, PubSubMessage, &global) } func init() { publish2fs.Initialize(ctx, &global) }
Notes ¶
- It replaces / by \ in asset names not to confilct with Firestore collection/document structure.
- Cloud FireStore share the same project's default location than Cloud Storage and App Engine.
- https://cloud.google.com/firestore/docs/locations#default-cloud-location
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EntryPoint ¶
EntryPoint is the function to be executed for each cloud function occurence
func Initialize ¶
Initialize is to be executed in the init() function of the cloud function to optimize the cold start
Types ¶
type Global ¶
type Global struct {
// contains filtered or unexported fields
}
Global structure for global variables to optimize the cloud function performances
type GoGCFDeployment ¶
type GoGCFDeployment struct { DumpTimestamp time.Time Settings Settings Artifacts gcf.GoGCFArtifacts }
GoGCFDeployment settings and artifacts structure
func NewGoGCFDeployment ¶
func NewGoGCFDeployment() *GoGCFDeployment
NewGoGCFDeployment create deployment structure
func (*GoGCFDeployment) DeployGoCloudFunction ¶
func (goGCFDeployment *GoGCFDeployment) DeployGoCloudFunction() (err error)
DeployGoCloudFunction deploy an instance of a microservice as a Go cloud function
type InstanceSettings ¶
type InstanceSettings struct { GCF struct { TriggerTopic string `yaml:"triggerTopic"` } }
InstanceSettings instance specific settings
type ServiceSettings ¶
type ServiceSettings struct { GCF struct { AvailableMemoryMb int64 `yaml:"availableMemoryMb" valid:"isAvailableMemory"` RetryTimeOutSeconds int64 `yaml:"retryTimeOutSeconds"` Timeout string `yaml:"timeout"` } GCB struct { BuildTimeout string `yaml:"buildTimeout"` } }
ServiceSettings defines service settings common to all service instances
type Settings ¶
type Settings struct { Solution ram.SolutionSettings Service ServiceSettings Instance InstanceSettings }
Settings flat settings structure: solution - service - instance