From fb5c5fb24453a886d549a40212f94a3ab854b357 Mon Sep 17 00:00:00 2001
From: tidwall
Date: Wed, 29 Aug 2018 14:20:07 -0600
Subject: [PATCH] 1.13.0
---
CHANGELOG.md | 13 ++++++++++++
README.md | 36 +++++++++++++++----------------
build.sh | 2 +-
cmd/tile38-cli/main.go | 5 ++++-
pkg/core/commands.json | 46 +++++++++++++++++++---------------------
pkg/core/commands_gen.go | 46 +++++++++++++++++++---------------------
6 files changed, 80 insertions(+), 68 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 85e074e8..752ff490 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,19 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
+
+## [1.13.0] - 2018-08-29
+### Added
+- eef5f3c: Add geofence notifications over pub/sub channels
+- 3a6f366: Add NODWELL keyword to roaming geofences
+- #343: Add Nats endpoints (@lennycampino)
+- #340: Add MQTT tls/cert options (@tobilg)
+- #314: Add CLIP subcommand to INTERSECTS
+
+### Changes
+- 3ae26e3: Updated B-tree implementation
+- 1d78a41: Updated R-tree implementation
+
## [1.12.3] - 2018-06-16
### Fixed
- #316: Fix AMQP and AMQPS webhook endpoints to support namespaces (@DeadWisdom)
diff --git a/README.md b/README.md
index c9bd6a02..c80140f5 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
-
+
@@ -24,7 +24,7 @@ Tile38 is an open source (MIT licensed), in-memory geolocation data store, spati
## Features
- Spatial index with [search](#searching) methods such as Nearby, Within, and Intersects.
-- Realtime [geofencing](#geofencing) through persistent sockets or [webhooks](http://tile38.com/commands/sethook).
+- Realtime [geofencing](#geofencing) through [webhooks](http://tile38.com/commands/sethook) or [pub/sub channels](#pub-sub-channels).
- Object types of [lat/lon](#latlon-point), [bbox](#bounding-box), [Geohash](#geohash), [GeoJSON](#geojson), [QuadKey](#quadkey), and [XYZ tile](#xyz-tile).
- Support for lots of [Clients Libraries](#client-libraries) written in many different languages.
- Variety of protocols, including [http](#http) (curl), [websockets](#websockets), [telnet](#telnet), and the [Redis RESP](http://redis.io/topics/protocol).
@@ -153,23 +153,7 @@ INTERSECTS searches a collection for objects that intersect a specified bounding
NEARBY searches a collection for objects that intersect a specified radius.
-
-
-
-
### Search options
-**SPARSE** - This option will distribute the results of a search evenly across the requested area.
-This is very helpful for example; when you have many (perhaps millions) of objects and do not want them all clustered together on a map. Sparse will limit the number of objects returned and provide them evenly distributed so that your map looks clean.
-You can choose a value between 1 and 8. The value 1 will result in no more than 4 items. The value 8 will result in no more than 65536. *1=4, 2=16, 3=64, 4=256, 5=1024, 6=4098, 7=16384, 8=65536.*
-
-No Sparsing |
-Sparse 1 |
-Sparse 2 |
-Sparse 3 |
-Sparse 4 |
-Sparse 5 |
-
-*Please note that the higher the sparse value, the slower the performance. Also, LIMIT and CURSOR are not available when using SPARSE.*
**WHERE** - This option allows for filtering out results based on [field](#fields) values. For example
```nearby fleet where speed 70 +inf point 33.462 -112.268 6000``` will return only the objects in the 'fleet' collection that are within the 6 km radius **and** have a field named `speed` that is greater than `70`.
Multiple WHEREs are concatenated as **and** clauses. ```WHERE speed 70 +inf WHERE age -inf 24``` would be interpreted as *speed is over 70 and age is less than 24.*
The default value for a field is always `0`. Thus if you do a WHERE on the field `speed` and an object does not have that field set, the server will pretend that the object does and that the value is Zero.
@@ -225,6 +209,22 @@ These can be used when establishing a geofence, to pre-filter responses. For ins
> nearby fleet fence detect enter,exit point 33.462 -112.268 6000
```
+### Pub/sub channels
+
+Tile38 supports delivering geofence notications over pub/sub channels.
+
+To create a static geofence that sends notifications when a bus is within 200 meters of a point and sends to the `busstop` channel:
+
+```
+> setchan busstop nearby buses fence point 33.5123 -112.2693 200
+```
+
+Subscribe on the `busstop` channel:
+
+```
+> subscribe busstop
+```
+
## Object types
All object types except for XYZ Tiles and QuadKeys can be stored in a collection. XYZ Tiles and QuadKeys are reserved for the SEARCH keyword only.
diff --git a/build.sh b/build.sh
index 7711c92f..acac4e68 100755
--- a/build.sh
+++ b/build.sh
@@ -4,7 +4,7 @@ set -e
cd $(dirname "${BASH_SOURCE[0]}")
OD="$(pwd)"
-VERSION=1.12.3
+VERSION=1.13.0
PROTECTED_MODE="no"
# Hardcode some values to the core package
diff --git a/cmd/tile38-cli/main.go b/cmd/tile38-cli/main.go
index c8129aa0..2fc61c5e 100644
--- a/cmd/tile38-cli/main.go
+++ b/cmd/tile38-cli/main.go
@@ -14,6 +14,7 @@ import (
"strings"
"github.com/peterh/liner"
+ "github.com/tidwall/gjson"
"github.com/tidwall/resp"
"github.com/tidwall/tile38/pkg/client"
"github.com/tidwall/tile38/pkg/core"
@@ -350,7 +351,9 @@ func main() {
fmt.Fprintln(os.Stderr, "(error) "+cerr.Err)
mustOutput = false
}
- } else if string(msg) == client.LiveJSON {
+ } else if gjson.GetBytes(msg, "command").String() == "psubscribe" ||
+ gjson.GetBytes(msg, "command").String() == "subscribe" ||
+ string(msg) == client.LiveJSON {
fmt.Fprintln(os.Stderr, string(msg))
livemode = true
break // break out of prompt and just feed data to screen
diff --git a/pkg/core/commands.json b/pkg/core/commands.json
index 34938f50..7ed55a77 100644
--- a/pkg/core/commands.json
+++ b/pkg/core/commands.json
@@ -1356,10 +1356,6 @@
"group": "webhook"
},
-
-
-
-
"SETCHAN": {
"summary": "Creates a pubsub channel which points to geofenced search",
"arguments": [
@@ -1444,26 +1440,28 @@
],
"group": "pubsub"
},
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ "SUBSCRIBE": {
+ "summary": "Subscribe to a geofence channel",
+ "arguments":[
+ {
+ "name": "channel",
+ "type": "string",
+ "variadic": true
+ }
+ ],
+ "group": "pubsub"
+ },
+ "PSUBSCRIBE": {
+ "summary": "Subscribes the client to the given patterns",
+ "arguments":[
+ {
+ "name": "pattern",
+ "type": "pattern",
+ "variadic": true
+ }
+ ],
+ "group": "pubsub"
+ },
"PDEL": {
"summary": "Removes all objects matching a pattern",
"arguments":[
diff --git a/pkg/core/commands_gen.go b/pkg/core/commands_gen.go
index c0dce127..54efd996 100644
--- a/pkg/core/commands_gen.go
+++ b/pkg/core/commands_gen.go
@@ -1522,10 +1522,6 @@ var commandsJSON = `{
"group": "webhook"
},
-
-
-
-
"SETCHAN": {
"summary": "Creates a pubsub channel which points to geofenced search",
"arguments": [
@@ -1610,26 +1606,28 @@ var commandsJSON = `{
],
"group": "pubsub"
},
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ "SUBSCRIBE": {
+ "summary": "Subscribe to a geofence channel",
+ "arguments":[
+ {
+ "name": "channel",
+ "type": "string",
+ "variadic": true
+ }
+ ],
+ "group": "pubsub"
+ },
+ "PSUBSCRIBE": {
+ "summary": "Subscribes the client to the given patterns",
+ "arguments":[
+ {
+ "name": "pattern",
+ "type": "pattern",
+ "variadic": true
+ }
+ ],
+ "group": "pubsub"
+ },
"PDEL": {
"summary": "Removes all objects matching a pattern",
"arguments":[