-
Notifications
You must be signed in to change notification settings - Fork 373
/
extension.yaml
125 lines (108 loc) · 4.4 KB
/
extension.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: firestore-counter
version: 0.2.11
specVersion: v1beta
displayName: Distributed Counter
description:
Records event counters at scale to accommodate high-velocity writes to Cloud
Firestore.
license: Apache-2.0
sourceUrl: https://github.com/firebase/extensions/tree/master/firestore-counter
releaseNotesUrl: https://github.com/firebase/extensions/blob/master/firestore-counter/CHANGELOG.md
author:
authorName: Firebase
url: https://firebase.google.com
contributors:
- authorName: Patryk Lesiewicz
url: https://github.com/lepatryk
- authorName: Invertase
email: oss@invertase.io
url: https://github.com/invertase
billingRequired: true
roles:
- role: datastore.user
reason: Allows the extension to aggregate Cloud Firestore counter shards.
- role: cloudscheduler.admin
reason: Allows the extension to create a new Cloud Scheduler function.
resources:
- name: controllerCore
type: firebaseextensions.v1beta.function
description:
This scheduled function either aggregates shards itself, or it schedules
and monitors workers to aggregate shards.
properties:
runtime: nodejs18
maxInstances: 1
scheduleTrigger:
schedule: "every ${param:SCHEDULE_FREQUENCY} minutes"
- name: onWrite
type: firebaseextensions.v1beta.function
description:
Listens for changes on counter shards that may need aggregating. This
function is limited to max 1 instance.
properties:
runtime: nodejs18
maxInstances: 1
timeout: 120s
eventTrigger:
eventType: providers/cloud.firestore/eventTypes/document.write
resource: projects/${param:PROJECT_ID}/databases/(default)/documents/{collection}/{counter=**}/_counter_shards_/{shardId}
- name: worker
type: firebaseextensions.v1beta.function
description:
Monitors a range of shards and aggregates them, as needed. There may be 0
or more worker functions running at any point in time. The controllerCore
function is responsible for scheduling and monitoring these workers.
properties:
runtime: nodejs18
eventTrigger:
eventType: providers/cloud.firestore/eventTypes/document.write
resource: projects/${param:PROJECT_ID}/databases/(default)/documents/${param:INTERNAL_STATE_PATH}/workers/{workerId}
params:
- param: INTERNAL_STATE_PATH
label: Document path for internal state
description: >-
What is the path to the document where the extension can keep its internal
state?
example: _firebase_ext_/sharded_counter
validationRegex: "^[^/]+/[^/]+(/[^/]+/[^/]+)*$"
validationErrorMessage:
Enter a document path, not a collection path. The path must have an even
number of segments, for example, `my_collection/doc` or
`my_collection/doc/subcollection/doc`, but not `my_collection`.
default: _firebase_ext_/sharded_counter
required: true
- param: SCHEDULE_FREQUENCY
label: Frequency for controllerCore function to be run
description: >-
In minutes, how often should the function to aggregate shards be run?
validationRegex: "^[1-9][0-9]*$"
validationErrorMessage:
The number of minutes must be an integer value greater than zero.
default: "1"
required: true
events:
- type: firebase.extensions.firestore-counter.v1.onStart
description:
Occurs when a trigger has been called within the Extension, and will
include data such as the context of the trigger request.
- type: firebase.extensions.firestore-counter.v1.onError
description:
Occurs when an issue has been experienced in the Extension. This will
include any error data that has been included within the Error Exception.
- type: firebase.extensions.firestore-counter.v1.onCompletion
description:
Occurs when the function is settled. Provides no customized data other
than the context.