publish2fs

package
v0.0.17-rc3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

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.

Required environment variables

- COLLECTION_ID the name of the FireStore collection grouping all assets documents

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EntryPoint

func EntryPoint(ctxEvent context.Context, PubSubMessage ram.PubSubMessage, global *Global) error

EntryPoint is the function to be executed for each cloud function occurence

func Initialize

func Initialize(ctx context.Context, global *Global)

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

Jump to

Keyboard shortcuts

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