Skip to content

Commit

Permalink
switch to arrow syntax for triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
autom8ter committed Jan 2, 2021
1 parent 3d10b0d commit 5b99605
Show file tree
Hide file tree
Showing 27 changed files with 884 additions and 1,268 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.1.3
current_version = 1.2.0
commit = False
tag = False

Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- server raft on same port as metrics server - 7821 by default
- add k8s manifest
## [1.1.2] - 2020-12-31
- mutual tls options client/server side
- mutual tls options client/server side

## [1.2.0] - 2020-1-1
- switch to arrow syntax for triggers
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version := "1.1.3"
version := "1.2.0"

.DEFAULT_GOAL := help

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ https://graphikdb.github.io/graphik/

`git clone [email protected]:graphikDB/graphik.git`

`docker pull graphikdb/graphik:v1.1.3`
`docker pull graphikdb/graphik:v1.2.0`

Graphik is a Backend as a Service implemented as an identity-aware, permissioned, persistant document/graph database & pubsub server written in Go.

Expand Down Expand Up @@ -914,7 +914,7 @@ add this docker-compose.yml to ${pwd}:
version: '3.7'
services:
graphik:
image: graphikdb/graphik:v1.1.3
image: graphikdb/graphik:v1.2.0
env_file:
- .env
ports:
Expand Down
10 changes: 1 addition & 9 deletions database/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,7 @@ func (g *Graph) cacheTriggers() error {
if err := proto.Unmarshal(v, &i); err != nil {
return err
}
if i.GetExpression() == "" {
return nil
}
decision, err := trigger.NewDecision(i.GetExpression())
if err != nil {
return errors.Wrapf(err, "failed to cache trigger decision: %s", i.GetName())
}
trig, err := trigger.NewTrigger(decision, i.GetTrigger())
trig, err := trigger.NewArrowTrigger(i.GetTrigger())
if err != nil {
return errors.Wrapf(err, "failed to cache trigger expression: %s", i.GetName())
}
Expand Down Expand Up @@ -316,7 +309,6 @@ func (g *Graph) setTrigger(ctx context.Context, tx *bbolt.Tx, i *apipb.Trigger)
if err != nil {
return nil, err
}
current.Expression = i.Expression
current.TargetDocs = i.TargetDocs
current.TargetConnections = i.TargetConnections
current.Gtype = i.Gtype
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.7'
services:
graphik:
image: graphikdb/graphik:v1.1.3
image: graphikdb/graphik:v1.2.0
env_file:
- .env
ports:
Expand Down
2 changes: 1 addition & 1 deletion gen/gql/docs/trigger.doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ <h2 id="graphql-schema-definition" class="graphdoc-section__title slds-text-head
</a>
GraphQL Schema definition
</h2>
<code class="highlight"><ul class="code" style="padding-left:42px"><li><span class="keyword operator ts">type</span> <span class="identifier">Trigger</span> {</li><li></li><li><span class="tab"><span class="comment line"># name is the unique name of the constraint</span></span></li><li><span class="tab"><span class="meta">name</span>: <a class="support type" href="string.doc.html">String</a>! </span></li><li></li><li><span class="tab"><span class="comment line"># gtype is the type of object the constraint will be applied to (ex: user)</span></span></li><li><span class="tab"><span class="meta">gtype</span>: <a class="support type" href="string.doc.html">String</a>! </span></li><li></li><li><span class="tab"><span class="comment line"># expression is a boolean CEL expression used to evaluate the doc/connection</span></span></li><li><span class="tab"><span class="meta">expression</span>: <a class="support type" href="string.doc.html">String</a>! </span></li><li></li><li><span class="tab"><span class="comment line"># trigger is the map CEL expression that mutates the doc/connection before it is </span></span></li><li><span class="tab"><span class="comment line"># stored</span></span></li><li><span class="tab"><span class="meta">trigger</span>: <a class="support type" href="string.doc.html">String</a>! </span></li><li></li><li><span class="tab"><span class="comment line"># if target_docs is true, this constraint will be applied to documents.</span></span></li><li><span class="tab"><span class="meta">target_docs</span>: <a class="support type" href="boolean.doc.html">Boolean</a>! </span></li><li></li><li><span class="tab"><span class="comment line"># if target_connections is true, this constraint will be applied to connections.</span></span></li><li><span class="tab"><span class="meta">target_connections</span>: <a class="support type" href="boolean.doc.html">Boolean</a>! </span></li><li>}</li></ul></code>
<code class="highlight"><ul class="code" style="padding-left:42px"><li><span class="keyword operator ts">type</span> <span class="identifier">Trigger</span> {</li><li></li><li><span class="tab"><span class="comment line"># name is the unique name of the constraint</span></span></li><li><span class="tab"><span class="meta">name</span>: <a class="support type" href="string.doc.html">String</a>! </span></li><li></li><li><span class="tab"><span class="comment line"># gtype is the type of object the constraint will be applied to (ex: user)</span></span></li><li><span class="tab"><span class="meta">gtype</span>: <a class="support type" href="string.doc.html">String</a>! </span></li><li></li><li><span class="tab"><span class="comment line"># trigger is the arrow syntax expression that mutates the doc/connection before it </span></span></li><li><span class="tab"><span class="comment line"># is stored ref: https://github.com/graphikDB/trigger</span></span></li><li><span class="tab"><span class="meta">trigger</span>: <a class="support type" href="string.doc.html">String</a>! </span></li><li></li><li><span class="tab"><span class="comment line"># if target_docs is true, this constraint will be applied to documents.</span></span></li><li><span class="tab"><span class="meta">target_docs</span>: <a class="support type" href="boolean.doc.html">Boolean</a>! </span></li><li></li><li><span class="tab"><span class="comment line"># if target_connections is true, this constraint will be applied to connections.</span></span></li><li><span class="tab"><span class="meta">target_connections</span>: <a class="support type" href="boolean.doc.html">Boolean</a>! </span></li><li>}</li></ul></code>
</div>
</section>
<section>
Expand Down
2 changes: 1 addition & 1 deletion gen/gql/docs/triggerinput.doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ <h2 id="graphql-schema-definition" class="graphdoc-section__title slds-text-head
</a>
GraphQL Schema definition
</h2>
<code class="highlight"><ul class="code" style="padding-left:42px"><li><span class="keyword operator ts">input</span> <span class="identifier">TriggerInput</span> {</li><li><span class="tab"><li><span class="tab"><span class="comment line"># name is the unique name of the constraint</span></span></li><li><span class="tab"><span class="meta">name</span>: <a class="support type" href="string.doc.html">String</a>!</span></li></span></li><li><span class="tab"><li><span class="tab"><span class="comment line"># gtype is the type of object the constraint will be applied to (ex: user)</span></span></li><li><span class="tab"><span class="meta">gtype</span>: <a class="support type" href="string.doc.html">String</a>!</span></li></span></li><li><span class="tab"><li><span class="tab"><span class="comment line"># expression is a boolean CEL expression used to evaluate the doc/connection</span></span></li><li><span class="tab"><span class="meta">expression</span>: <a class="support type" href="string.doc.html">String</a>!</span></li></span></li><li><span class="tab"><li><span class="tab"><span class="comment line"># trigger is the map CEL expression that mutates the doc/connection before it is </span></span></li><li><span class="tab"><span class="comment line"># stored</span></span></li><li><span class="tab"><span class="meta">trigger</span>: <a class="support type" href="string.doc.html">String</a>!</span></li></span></li><li><span class="tab"><li><span class="tab"><span class="comment line"># if target_docs is true, this constraint will be applied to documents.</span></span></li><li><span class="tab"><span class="meta">target_docs</span>: <a class="support type" href="boolean.doc.html">Boolean</a>!</span></li></span></li><li><span class="tab"><li><span class="tab"><span class="comment line"># if target_connections is true, this constraint will be applied to connections.</span></span></li><li><span class="tab"><span class="meta">target_connections</span>: <a class="support type" href="boolean.doc.html">Boolean</a>!</span></li></span></li><li>}</li></ul></code>
<code class="highlight"><ul class="code" style="padding-left:42px"><li><span class="keyword operator ts">input</span> <span class="identifier">TriggerInput</span> {</li><li><span class="tab"><li><span class="tab"><span class="comment line"># name is the unique name of the constraint</span></span></li><li><span class="tab"><span class="meta">name</span>: <a class="support type" href="string.doc.html">String</a>!</span></li></span></li><li><span class="tab"><li><span class="tab"><span class="comment line"># gtype is the type of object the constraint will be applied to (ex: user)</span></span></li><li><span class="tab"><span class="meta">gtype</span>: <a class="support type" href="string.doc.html">String</a>!</span></li></span></li><li><span class="tab"><li><span class="tab"><span class="comment line"># trigger is the arrow syntax expression that mutates the doc/connection before it </span></span></li><li><span class="tab"><span class="comment line"># is stored ref: https://github.com/graphikDB/trigger</span></span></li><li><span class="tab"><span class="meta">trigger</span>: <a class="support type" href="string.doc.html">String</a>!</span></li></span></li><li><span class="tab"><li><span class="tab"><span class="comment line"># if target_docs is true, this constraint will be applied to documents.</span></span></li><li><span class="tab"><span class="meta">target_docs</span>: <a class="support type" href="boolean.doc.html">Boolean</a>!</span></li></span></li><li><span class="tab"><li><span class="tab"><span class="comment line"># if target_connections is true, this constraint will be applied to connections.</span></span></li><li><span class="tab"><span class="meta">target_connections</span>: <a class="support type" href="boolean.doc.html">Boolean</a>!</span></li></span></li><li>}</li></ul></code>
</div>
</section>
<section>
Expand Down
64 changes: 2 additions & 62 deletions gen/gql/go/generated/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions gen/gql/go/model/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5b99605

Please sign in to comment.