diff --git a/README.md b/README.md index 8b8fb81b..babef1f2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

Tile38

@@ -14,11 +14,11 @@ Tile38 is an open source (MIT licensed), in-memory geolocation data store, spati

This README is quick start document. You can find detailed documentation at http://tile38.com.

-Nearby -Within -Intersects -Geofencing -Roaming Geofences +Nearby +Within +Intersects +Geofencing +Roaming Geofences

## Features @@ -142,19 +142,19 @@ To set a field when an object already exists: Tile38 has support to search for objects and points that are within or intersects other objects. All object types can be searched including Polygons, MultiPolygons, GeometryCollections, etc. -Search Within +Search Within #### Within WITHIN searches a collection for objects that are fully contained inside a specified bounding area.
-Search Intersects +Search Intersects #### Intersects INTERSECTS searches a collection for objects that intersect a specified bounding area.
-Search Nearby +Search Nearby #### Nearby NEARBY searches a collection for objects that intersect a specified radius. @@ -169,12 +169,12 @@ NEARBY searches a collection for objects that intersect a specified radius. 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 SparsingSearch WithinSparse 1Search WithinSparse 2Search WithinSparse 3Search WithinSparse 4Search WithinSparse 5Search WithinNo SparsingSearch WithinSparse 1Search WithinSparse 2Search WithinSparse 3Search WithinSparse 4Search WithinSparse 5Search Within
*Please note that the higher the sparse value, the slower the performance. Also, LIMIT and CURSOR are not available when using SPARSE.* @@ -191,7 +191,7 @@ You can choose a value between 1 and 8. The value 1 will result in no more than ## Geofencing -Geofence animation +Geofence animation A geofence is a virtual boundary that can detect when an object enters or exits the area. This boundary can be a radius, bounding box, or a polygon. Tile38 can turn any standard search into a geofence monitor by adding the FENCE keyword to the search. *Tile38 also allows for [Webhooks](http://tile38.com/commands/sethook) to be assigned to Geofences.* diff --git a/build.sh b/build.sh index 4e3e2cce..f515375e 100755 --- a/build.sh +++ b/build.sh @@ -5,13 +5,13 @@ VERSION="1.12.0" PROTECTED_MODE="no" # Hardcode some values to the core package -LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.Version=${VERSION}" +LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/pkg/core.Version=${VERSION}" if [ -d ".git" ]; then - LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.GitSHA=$(git rev-parse --short HEAD)" + LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/pkg/core.GitSHA=$(git rev-parse --short HEAD)" fi -LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.BuildTime=$(date +%FT%T%z)" +LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/pkg/core.BuildTime=$(date +%FT%T%z)" if [ "$PROTECTED_MODE" == "no" ]; then - LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.ProtectedMode=no" + LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/pkg/core.ProtectedMode=no" fi if [ "$1" == "update-version" ]; then @@ -129,6 +129,9 @@ if [ "$NOLINK" != "1" ]; then cd "$TMP/go/src/github.com/tidwall/tile38" fi +# generate the core package +pkg/core/gen.sh + # build and store objects into original directory. go build -ldflags "$LDFLAGS" -o "$OD/tile38-server" cmd/tile38-server/*.go go build -ldflags "$LDFLAGS" -o "$OD/tile38-cli" cmd/tile38-cli/*.go diff --git a/cmd/tile38-benchmark/main.go b/cmd/tile38-benchmark/main.go index 772568cc..1c9c75bd 100644 --- a/cmd/tile38-benchmark/main.go +++ b/cmd/tile38-benchmark/main.go @@ -11,7 +11,7 @@ import ( "time" "github.com/tidwall/redbench" - "github.com/tidwall/tile38/core" + "github.com/tidwall/tile38/pkg/core" ) var ( diff --git a/cmd/tile38-cli/kml.go b/cmd/tile38-cli/kml.go index 2ac2fdaf..5a116ef9 100644 --- a/cmd/tile38-cli/kml.go +++ b/cmd/tile38-cli/kml.go @@ -4,7 +4,7 @@ import ( "bytes" "fmt" - "github.com/tidwall/tile38/geojson" + "github.com/tidwall/tile38/pkg/geojson" ) type pointT struct { diff --git a/cmd/tile38-cli/main.go b/cmd/tile38-cli/main.go index d962d4ed..ff5893db 100644 --- a/cmd/tile38-cli/main.go +++ b/cmd/tile38-cli/main.go @@ -15,8 +15,8 @@ import ( "github.com/peterh/liner" "github.com/tidwall/resp" - "github.com/tidwall/tile38/client" - "github.com/tidwall/tile38/core" + "github.com/tidwall/tile38/pkg/client" + "github.com/tidwall/tile38/pkg/core" ) func userHomeDir() string { diff --git a/cmd/tile38-server/main.go b/cmd/tile38-server/main.go index 7746c875..97fbcb9e 100644 --- a/cmd/tile38-server/main.go +++ b/cmd/tile38-server/main.go @@ -19,10 +19,10 @@ import ( "google.golang.org/grpc" - "github.com/tidwall/tile38/controller" - "github.com/tidwall/tile38/controller/log" - "github.com/tidwall/tile38/core" - "github.com/tidwall/tile38/hservice" + "github.com/tidwall/tile38/pkg/controller" + "github.com/tidwall/tile38/pkg/core" + "github.com/tidwall/tile38/pkg/hservice" + "github.com/tidwall/tile38/pkg/log" ) var ( diff --git a/docker/README.md b/docker/README.md index 45159140..59caf340 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,4 +1,4 @@ -![Tile38 Logo](https://raw.githubusercontent.com/tidwall/tile38/master/doc/logo200.png) +![Tile38 Logo](https://raw.githubusercontent.com/tidwall/tile38/master/res/logo200.png) Tile38 is an open source (MIT licensed), in-memory geolocation data store, spatial index, and realtime geofence. It supports a variety of object types including lat/lon points, bounding boxes, XYZ tiles, Geohashes, and GeoJSON. @@ -17,6 +17,7 @@ Tile38 is an open source (MIT licensed), in-memory geolocation data store, spati - In-memory database that persists on disk. ## Contact + Josh Baker [@tidwall](http://twitter.com/tidwall) ## License diff --git a/controller/bing/bing.go b/pkg/bing/bing.go similarity index 100% rename from controller/bing/bing.go rename to pkg/bing/bing.go diff --git a/controller/bing/bing_test.go b/pkg/bing/bing_test.go similarity index 100% rename from controller/bing/bing_test.go rename to pkg/bing/bing_test.go diff --git a/controller/bing/ext.go b/pkg/bing/ext.go similarity index 100% rename from controller/bing/ext.go rename to pkg/bing/ext.go diff --git a/controller/bing/ext_test.go b/pkg/bing/ext_test.go similarity index 100% rename from controller/bing/ext_test.go rename to pkg/bing/ext_test.go diff --git a/client/README.md b/pkg/client/README.md similarity index 100% rename from client/README.md rename to pkg/client/README.md diff --git a/client/conn.go b/pkg/client/conn.go similarity index 100% rename from client/conn.go rename to pkg/client/conn.go diff --git a/client/conn_test.go b/pkg/client/conn_test.go similarity index 100% rename from client/conn_test.go rename to pkg/client/conn_test.go diff --git a/client/helper.go b/pkg/client/helper.go similarity index 100% rename from client/helper.go rename to pkg/client/helper.go diff --git a/client/pool.go b/pkg/client/pool.go similarity index 100% rename from client/pool.go rename to pkg/client/pool.go diff --git a/client/pool_test.go b/pkg/client/pool_test.go similarity index 100% rename from client/pool_test.go rename to pkg/client/pool_test.go diff --git a/controller/collection/collection.go b/pkg/collection/collection.go similarity index 99% rename from controller/collection/collection.go rename to pkg/collection/collection.go index 198a4fa1..36cb0b89 100644 --- a/controller/collection/collection.go +++ b/pkg/collection/collection.go @@ -4,8 +4,8 @@ import ( "math" "github.com/tidwall/btree" - "github.com/tidwall/tile38/geojson" - "github.com/tidwall/tile38/index" + "github.com/tidwall/tile38/pkg/geojson" + "github.com/tidwall/tile38/pkg/index" ) const ( diff --git a/controller/collection/collection_test.go b/pkg/collection/collection_test.go similarity index 99% rename from controller/collection/collection_test.go rename to pkg/collection/collection_test.go index ecd9ac78..dcc34bf1 100644 --- a/controller/collection/collection_test.go +++ b/pkg/collection/collection_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/tidwall/tile38/geojson" + "github.com/tidwall/tile38/pkg/geojson" ) func TestCollection(t *testing.T) { diff --git a/controller/aof.go b/pkg/controller/aof.go similarity index 99% rename from controller/aof.go rename to pkg/controller/aof.go index efbb4731..25b08d93 100644 --- a/controller/aof.go +++ b/pkg/controller/aof.go @@ -14,8 +14,8 @@ import ( "github.com/tidwall/buntdb" "github.com/tidwall/redcon" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/log" - "github.com/tidwall/tile38/controller/server" + "github.com/tidwall/tile38/pkg/log" + "github.com/tidwall/tile38/pkg/server" ) // AsyncHooks indicates that the hooks should happen in the background. diff --git a/controller/aofmigrate.go b/pkg/controller/aofmigrate.go similarity index 98% rename from controller/aofmigrate.go rename to pkg/controller/aofmigrate.go index 94885cc0..31fe3d98 100644 --- a/controller/aofmigrate.go +++ b/pkg/controller/aofmigrate.go @@ -10,7 +10,7 @@ import ( "time" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/log" + "github.com/tidwall/tile38/pkg/log" ) var errCorruptedAOF = errors.New("corrupted aof file") diff --git a/controller/aofshrink.go b/pkg/controller/aofshrink.go similarity index 97% rename from controller/aofshrink.go rename to pkg/controller/aofshrink.go index 3e5afe49..4180b911 100644 --- a/controller/aofshrink.go +++ b/pkg/controller/aofshrink.go @@ -8,10 +8,10 @@ import ( "strings" "time" - "github.com/tidwall/tile38/controller/collection" - "github.com/tidwall/tile38/controller/log" - "github.com/tidwall/tile38/core" - "github.com/tidwall/tile38/geojson" + "github.com/tidwall/tile38/pkg/collection" + "github.com/tidwall/tile38/pkg/core" + "github.com/tidwall/tile38/pkg/geojson" + "github.com/tidwall/tile38/pkg/log" ) const maxkeys = 8 diff --git a/controller/atomic.go b/pkg/controller/atomic.go similarity index 100% rename from controller/atomic.go rename to pkg/controller/atomic.go diff --git a/controller/atomic_test.go b/pkg/controller/atomic_test.go similarity index 100% rename from controller/atomic_test.go rename to pkg/controller/atomic_test.go diff --git a/controller/bson.go b/pkg/controller/bson.go similarity index 100% rename from controller/bson.go rename to pkg/controller/bson.go diff --git a/controller/checksum.go b/pkg/controller/checksum.go similarity index 98% rename from controller/checksum.go rename to pkg/controller/checksum.go index 1e2dcdf1..ea4217b8 100644 --- a/controller/checksum.go +++ b/pkg/controller/checksum.go @@ -9,8 +9,8 @@ import ( "time" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/log" - "github.com/tidwall/tile38/core" + "github.com/tidwall/tile38/pkg/core" + "github.com/tidwall/tile38/pkg/log" ) // checksum performs a simple md5 checksum on the aof file diff --git a/controller/client.go b/pkg/controller/client.go similarity index 99% rename from controller/client.go rename to pkg/controller/client.go index e597d0c3..bf373609 100644 --- a/controller/client.go +++ b/pkg/controller/client.go @@ -9,7 +9,7 @@ import ( "time" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/server" + "github.com/tidwall/tile38/pkg/server" ) // Conn represents a simple resp connection. diff --git a/controller/config.go b/pkg/controller/config.go similarity index 99% rename from controller/config.go rename to pkg/controller/config.go index 408d7f8c..17c97f99 100644 --- a/controller/config.go +++ b/pkg/controller/config.go @@ -12,8 +12,8 @@ import ( "github.com/tidwall/gjson" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/glob" - "github.com/tidwall/tile38/controller/server" + "github.com/tidwall/tile38/pkg/glob" + "github.com/tidwall/tile38/pkg/server" ) const ( diff --git a/controller/controller.go b/pkg/controller/controller.go similarity index 98% rename from controller/controller.go rename to pkg/controller/controller.go index 6a507e73..66aa6ae7 100644 --- a/controller/controller.go +++ b/pkg/controller/controller.go @@ -19,12 +19,12 @@ import ( "github.com/tidwall/btree" "github.com/tidwall/buntdb" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/collection" - "github.com/tidwall/tile38/controller/endpoint" - "github.com/tidwall/tile38/controller/log" - "github.com/tidwall/tile38/controller/server" - "github.com/tidwall/tile38/core" - "github.com/tidwall/tile38/geojson" + "github.com/tidwall/tile38/pkg/collection" + "github.com/tidwall/tile38/pkg/core" + "github.com/tidwall/tile38/pkg/endpoint" + "github.com/tidwall/tile38/pkg/geojson" + "github.com/tidwall/tile38/pkg/log" + "github.com/tidwall/tile38/pkg/server" ) var errOOM = errors.New("OOM command not allowed when used memory > 'maxmemory'") diff --git a/controller/crud.go b/pkg/controller/crud.go similarity index 99% rename from controller/crud.go rename to pkg/controller/crud.go index 9eb4c144..222b5908 100644 --- a/controller/crud.go +++ b/pkg/controller/crud.go @@ -9,11 +9,11 @@ import ( "github.com/tidwall/btree" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/collection" - "github.com/tidwall/tile38/controller/glob" - "github.com/tidwall/tile38/controller/server" - "github.com/tidwall/tile38/geojson" - "github.com/tidwall/tile38/geojson/geohash" + "github.com/tidwall/tile38/pkg/collection" + "github.com/tidwall/tile38/pkg/geojson" + "github.com/tidwall/tile38/pkg/geojson/geohash" + "github.com/tidwall/tile38/pkg/glob" + "github.com/tidwall/tile38/pkg/server" ) type fvt struct { diff --git a/controller/dev.go b/pkg/controller/dev.go similarity index 97% rename from controller/dev.go rename to pkg/controller/dev.go index 6676864c..498df6af 100644 --- a/controller/dev.go +++ b/pkg/controller/dev.go @@ -10,8 +10,8 @@ import ( "time" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/log" - "github.com/tidwall/tile38/controller/server" + "github.com/tidwall/tile38/pkg/log" + "github.com/tidwall/tile38/pkg/server" ) // MASSINSERT num_keys num_points [minx miny maxx maxy] diff --git a/controller/expire.go b/pkg/controller/expire.go similarity index 98% rename from controller/expire.go rename to pkg/controller/expire.go index 32addcc3..ec569719 100644 --- a/controller/expire.go +++ b/pkg/controller/expire.go @@ -7,7 +7,7 @@ import ( "github.com/tidwall/btree" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/server" + "github.com/tidwall/tile38/pkg/server" ) type exitem struct { diff --git a/controller/fence.go b/pkg/controller/fence.go similarity index 98% rename from controller/fence.go rename to pkg/controller/fence.go index 09729934..471702ae 100644 --- a/controller/fence.go +++ b/pkg/controller/fence.go @@ -6,9 +6,9 @@ import ( "time" "github.com/tidwall/gjson" - "github.com/tidwall/tile38/controller/glob" - "github.com/tidwall/tile38/controller/server" - "github.com/tidwall/tile38/geojson" + "github.com/tidwall/tile38/pkg/geojson" + "github.com/tidwall/tile38/pkg/glob" + "github.com/tidwall/tile38/pkg/server" ) // FenceMatch executes a fence match returns back json messages for fence detection. diff --git a/controller/follow.go b/pkg/controller/follow.go similarity index 97% rename from controller/follow.go rename to pkg/controller/follow.go index 7f14ec47..b69f980f 100644 --- a/controller/follow.go +++ b/pkg/controller/follow.go @@ -10,9 +10,9 @@ import ( "time" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/log" - "github.com/tidwall/tile38/controller/server" - "github.com/tidwall/tile38/core" + "github.com/tidwall/tile38/pkg/core" + "github.com/tidwall/tile38/pkg/log" + "github.com/tidwall/tile38/pkg/server" ) var errNoLongerFollowing = errors.New("no longer following") diff --git a/controller/hooks.go b/pkg/controller/hooks.go similarity index 98% rename from controller/hooks.go rename to pkg/controller/hooks.go index 3b291940..b5e341b1 100644 --- a/controller/hooks.go +++ b/pkg/controller/hooks.go @@ -11,10 +11,10 @@ import ( "github.com/tidwall/buntdb" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/endpoint" - "github.com/tidwall/tile38/controller/glob" - "github.com/tidwall/tile38/controller/log" - "github.com/tidwall/tile38/controller/server" + "github.com/tidwall/tile38/pkg/endpoint" + "github.com/tidwall/tile38/pkg/glob" + "github.com/tidwall/tile38/pkg/log" + "github.com/tidwall/tile38/pkg/server" ) var hookLogSetDefaults = &buntdb.SetOptions{ diff --git a/controller/json.go b/pkg/controller/json.go similarity index 97% rename from controller/json.go rename to pkg/controller/json.go index d4004d86..749f2722 100644 --- a/controller/json.go +++ b/pkg/controller/json.go @@ -10,9 +10,9 @@ import ( "github.com/tidwall/gjson" "github.com/tidwall/resp" "github.com/tidwall/sjson" - "github.com/tidwall/tile38/controller/collection" - "github.com/tidwall/tile38/controller/server" - "github.com/tidwall/tile38/geojson" + "github.com/tidwall/tile38/pkg/collection" + "github.com/tidwall/tile38/pkg/geojson" + "github.com/tidwall/tile38/pkg/server" ) func appendJSONString(b []byte, s string) []byte { diff --git a/controller/json_test.go b/pkg/controller/json_test.go similarity index 100% rename from controller/json_test.go rename to pkg/controller/json_test.go diff --git a/controller/keys.go b/pkg/controller/keys.go similarity index 95% rename from controller/keys.go rename to pkg/controller/keys.go index b37f908a..98ad0376 100644 --- a/controller/keys.go +++ b/pkg/controller/keys.go @@ -7,8 +7,8 @@ import ( "github.com/tidwall/btree" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/glob" - "github.com/tidwall/tile38/controller/server" + "github.com/tidwall/tile38/pkg/glob" + "github.com/tidwall/tile38/pkg/server" ) func (c *Controller) cmdKeys(msg *server.Message) (res resp.Value, err error) { diff --git a/controller/live.go b/pkg/controller/live.go similarity index 97% rename from controller/live.go rename to pkg/controller/live.go index a49a09ca..8869ad7d 100644 --- a/controller/live.go +++ b/pkg/controller/live.go @@ -8,8 +8,8 @@ import ( "net" "sync" - "github.com/tidwall/tile38/controller/log" - "github.com/tidwall/tile38/controller/server" + "github.com/tidwall/tile38/pkg/log" + "github.com/tidwall/tile38/pkg/server" ) type liveBuffer struct { diff --git a/controller/output.go b/pkg/controller/output.go similarity index 95% rename from controller/output.go rename to pkg/controller/output.go index 838d7af7..9a6cc5b6 100644 --- a/controller/output.go +++ b/pkg/controller/output.go @@ -5,7 +5,7 @@ import ( "time" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/server" + "github.com/tidwall/tile38/pkg/server" ) func (c *Controller) cmdOutput(msg *server.Message) (res resp.Value, err error) { diff --git a/controller/readonly.go b/pkg/controller/readonly.go similarity index 90% rename from controller/readonly.go rename to pkg/controller/readonly.go index 6183c7d3..fee36f20 100644 --- a/controller/readonly.go +++ b/pkg/controller/readonly.go @@ -5,8 +5,8 @@ import ( "time" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/log" - "github.com/tidwall/tile38/controller/server" + "github.com/tidwall/tile38/pkg/log" + "github.com/tidwall/tile38/pkg/server" ) func (c *Controller) cmdReadOnly(msg *server.Message) (res resp.Value, err error) { diff --git a/controller/scan.go b/pkg/controller/scan.go similarity index 94% rename from controller/scan.go rename to pkg/controller/scan.go index 2ba19809..08107795 100644 --- a/controller/scan.go +++ b/pkg/controller/scan.go @@ -6,9 +6,9 @@ import ( "time" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/glob" - "github.com/tidwall/tile38/controller/server" - "github.com/tidwall/tile38/geojson" + "github.com/tidwall/tile38/pkg/geojson" + "github.com/tidwall/tile38/pkg/glob" + "github.com/tidwall/tile38/pkg/server" ) func (c *Controller) cmdScanArgs(vs []resp.Value) (s liveFenceSwitches, err error) { diff --git a/controller/scanner.go b/pkg/controller/scanner.go similarity index 98% rename from controller/scanner.go rename to pkg/controller/scanner.go index d48c67c9..113dde12 100644 --- a/controller/scanner.go +++ b/pkg/controller/scanner.go @@ -8,10 +8,10 @@ import ( "sync" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/collection" - "github.com/tidwall/tile38/controller/glob" - "github.com/tidwall/tile38/controller/server" - "github.com/tidwall/tile38/geojson" + "github.com/tidwall/tile38/pkg/collection" + "github.com/tidwall/tile38/pkg/geojson" + "github.com/tidwall/tile38/pkg/glob" + "github.com/tidwall/tile38/pkg/server" ) const limitItems = 100 diff --git a/controller/scripts.go b/pkg/controller/scripts.go similarity index 99% rename from controller/scripts.go rename to pkg/controller/scripts.go index ea4ec6ca..53426736 100644 --- a/controller/scripts.go +++ b/pkg/controller/scripts.go @@ -14,7 +14,7 @@ import ( "time" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/server" + "github.com/tidwall/tile38/pkg/server" "github.com/yuin/gopher-lua" luajson "layeh.com/gopher-json" ) diff --git a/controller/search.go b/pkg/controller/search.go similarity index 98% rename from controller/search.go rename to pkg/controller/search.go index 7c7cfe3d..d38c95ce 100644 --- a/controller/search.go +++ b/pkg/controller/search.go @@ -9,11 +9,11 @@ import ( "time" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/bing" - "github.com/tidwall/tile38/controller/glob" - "github.com/tidwall/tile38/controller/server" - "github.com/tidwall/tile38/geojson" - "github.com/tidwall/tile38/geojson/geohash" + "github.com/tidwall/tile38/pkg/bing" + "github.com/tidwall/tile38/pkg/geojson" + "github.com/tidwall/tile38/pkg/geojson/geohash" + "github.com/tidwall/tile38/pkg/glob" + "github.com/tidwall/tile38/pkg/server" ) type liveFenceSwitches struct { diff --git a/controller/stats.go b/pkg/controller/stats.go similarity index 99% rename from controller/stats.go rename to pkg/controller/stats.go index bd4668a1..ee5a01f0 100644 --- a/controller/stats.go +++ b/pkg/controller/stats.go @@ -12,8 +12,8 @@ import ( "github.com/tidwall/btree" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/server" - "github.com/tidwall/tile38/core" + "github.com/tidwall/tile38/pkg/core" + "github.com/tidwall/tile38/pkg/server" ) func (c *Controller) cmdStats(msg *server.Message) (res resp.Value, err error) { diff --git a/controller/stats_cpu.go b/pkg/controller/stats_cpu.go similarity index 100% rename from controller/stats_cpu.go rename to pkg/controller/stats_cpu.go diff --git a/controller/stats_cpu_darlin.go b/pkg/controller/stats_cpu_darlin.go similarity index 100% rename from controller/stats_cpu_darlin.go rename to pkg/controller/stats_cpu_darlin.go diff --git a/controller/token.go b/pkg/controller/token.go similarity index 100% rename from controller/token.go rename to pkg/controller/token.go diff --git a/controller/token_test.go b/pkg/controller/token_test.go similarity index 100% rename from controller/token_test.go rename to pkg/controller/token_test.go diff --git a/core/commands.go b/pkg/core/commands.go similarity index 100% rename from core/commands.go rename to pkg/core/commands.go diff --git a/core/commands.json b/pkg/core/commands.json similarity index 100% rename from core/commands.json rename to pkg/core/commands.json diff --git a/core/commands_gen.go b/pkg/core/commands_gen.go similarity index 100% rename from core/commands_gen.go rename to pkg/core/commands_gen.go diff --git a/core/commands_test.go b/pkg/core/commands_test.go similarity index 100% rename from core/commands_test.go rename to pkg/core/commands_test.go diff --git a/core/gen.sh b/pkg/core/gen.sh similarity index 100% rename from core/gen.sh rename to pkg/core/gen.sh diff --git a/core/options.go b/pkg/core/options.go similarity index 100% rename from core/options.go rename to pkg/core/options.go diff --git a/core/version.go b/pkg/core/version.go similarity index 100% rename from core/version.go rename to pkg/core/version.go diff --git a/controller/endpoint/amqp.go b/pkg/endpoint/amqp.go similarity index 100% rename from controller/endpoint/amqp.go rename to pkg/endpoint/amqp.go diff --git a/controller/endpoint/disque.go b/pkg/endpoint/disque.go similarity index 100% rename from controller/endpoint/disque.go rename to pkg/endpoint/disque.go diff --git a/controller/endpoint/endpoint.go b/pkg/endpoint/endpoint.go similarity index 100% rename from controller/endpoint/endpoint.go rename to pkg/endpoint/endpoint.go diff --git a/controller/endpoint/grpc.go b/pkg/endpoint/grpc.go similarity index 97% rename from controller/endpoint/grpc.go rename to pkg/endpoint/grpc.go index 821d586c..dd06414c 100644 --- a/controller/endpoint/grpc.go +++ b/pkg/endpoint/grpc.go @@ -8,7 +8,7 @@ import ( "golang.org/x/net/context" - "github.com/tidwall/tile38/hservice" + "github.com/tidwall/tile38/pkg/hservice" "google.golang.org/grpc" ) diff --git a/controller/endpoint/http.go b/pkg/endpoint/http.go similarity index 100% rename from controller/endpoint/http.go rename to pkg/endpoint/http.go diff --git a/controller/endpoint/kafka.go b/pkg/endpoint/kafka.go similarity index 100% rename from controller/endpoint/kafka.go rename to pkg/endpoint/kafka.go diff --git a/controller/endpoint/mqtt.go b/pkg/endpoint/mqtt.go similarity index 100% rename from controller/endpoint/mqtt.go rename to pkg/endpoint/mqtt.go diff --git a/controller/endpoint/redis.go b/pkg/endpoint/redis.go similarity index 100% rename from controller/endpoint/redis.go rename to pkg/endpoint/redis.go diff --git a/controller/endpoint/sqs.go b/pkg/endpoint/sqs.go similarity index 100% rename from controller/endpoint/sqs.go rename to pkg/endpoint/sqs.go diff --git a/geojson/bbox.go b/pkg/geojson/bbox.go similarity index 99% rename from geojson/bbox.go rename to pkg/geojson/bbox.go index de4fdc0e..e65fa763 100644 --- a/geojson/bbox.go +++ b/pkg/geojson/bbox.go @@ -5,7 +5,7 @@ import ( "strconv" "github.com/tidwall/gjson" - "github.com/tidwall/tile38/geojson/poly" + "github.com/tidwall/tile38/pkg/geojson/poly" ) // BBox is a bounding box diff --git a/geojson/detect_test.go b/pkg/geojson/detect_test.go similarity index 100% rename from geojson/detect_test.go rename to pkg/geojson/detect_test.go diff --git a/geojson/feature.go b/pkg/geojson/feature.go similarity index 99% rename from geojson/feature.go rename to pkg/geojson/feature.go index 8991378e..32b6908e 100644 --- a/geojson/feature.go +++ b/pkg/geojson/feature.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "github.com/tidwall/gjson" - "github.com/tidwall/tile38/geojson/geohash" + "github.com/tidwall/tile38/pkg/geojson/geohash" ) // Feature is a geojson object with the type "Feature" diff --git a/geojson/feature_test.go b/pkg/geojson/feature_test.go similarity index 100% rename from geojson/feature_test.go rename to pkg/geojson/feature_test.go diff --git a/geojson/featurecollection.go b/pkg/geojson/featurecollection.go similarity index 99% rename from geojson/featurecollection.go rename to pkg/geojson/featurecollection.go index 7e37b5bd..e41e0c51 100644 --- a/geojson/featurecollection.go +++ b/pkg/geojson/featurecollection.go @@ -2,7 +2,7 @@ package geojson import ( "github.com/tidwall/gjson" - "github.com/tidwall/tile38/geojson/geohash" + "github.com/tidwall/tile38/pkg/geojson/geohash" ) // FeatureCollection is a geojson object with the type "FeatureCollection" diff --git a/geojson/featurecollection_test.go b/pkg/geojson/featurecollection_test.go similarity index 100% rename from geojson/featurecollection_test.go rename to pkg/geojson/featurecollection_test.go diff --git a/geojson/geo/geo.go b/pkg/geojson/geo/geo.go similarity index 100% rename from geojson/geo/geo.go rename to pkg/geojson/geo/geo.go diff --git a/geojson/geohash/geohash.go b/pkg/geojson/geohash/geohash.go similarity index 100% rename from geojson/geohash/geohash.go rename to pkg/geojson/geohash/geohash.go diff --git a/geojson/geohash/geohash_test.go b/pkg/geojson/geohash/geohash_test.go similarity index 100% rename from geojson/geohash/geohash_test.go rename to pkg/geojson/geohash/geohash_test.go diff --git a/geojson/geojson_test.go b/pkg/geojson/geojson_test.go similarity index 100% rename from geojson/geojson_test.go rename to pkg/geojson/geojson_test.go diff --git a/geojson/geometrycollection.go b/pkg/geojson/geometrycollection.go similarity index 99% rename from geojson/geometrycollection.go rename to pkg/geojson/geometrycollection.go index 4aaba827..e73f2250 100644 --- a/geojson/geometrycollection.go +++ b/pkg/geojson/geometrycollection.go @@ -2,7 +2,7 @@ package geojson import ( "github.com/tidwall/gjson" - "github.com/tidwall/tile38/geojson/geohash" + "github.com/tidwall/tile38/pkg/geojson/geohash" ) // GeometryCollection is a geojson object with the type "GeometryCollection" diff --git a/geojson/geometrycollection_test.go b/pkg/geojson/geometrycollection_test.go similarity index 100% rename from geojson/geometrycollection_test.go rename to pkg/geojson/geometrycollection_test.go diff --git a/geojson/levels.go b/pkg/geojson/levels.go similarity index 100% rename from geojson/levels.go rename to pkg/geojson/levels.go diff --git a/geojson/linestring.go b/pkg/geojson/linestring.go similarity index 98% rename from geojson/linestring.go rename to pkg/geojson/linestring.go index eee21c22..e195272e 100644 --- a/geojson/linestring.go +++ b/pkg/geojson/linestring.go @@ -1,6 +1,6 @@ package geojson -import "github.com/tidwall/tile38/geojson/geohash" +import "github.com/tidwall/tile38/pkg/geojson/geohash" // LineString is a geojson object with the type "LineString" type LineString struct { diff --git a/geojson/linestring_test.go b/pkg/geojson/linestring_test.go similarity index 100% rename from geojson/linestring_test.go rename to pkg/geojson/linestring_test.go diff --git a/geojson/multilinestring.go b/pkg/geojson/multilinestring.go similarity index 97% rename from geojson/multilinestring.go rename to pkg/geojson/multilinestring.go index d30b8ce6..37c4bb04 100644 --- a/geojson/multilinestring.go +++ b/pkg/geojson/multilinestring.go @@ -1,8 +1,8 @@ package geojson import ( - "github.com/tidwall/tile38/geojson/geohash" - "github.com/tidwall/tile38/geojson/poly" + "github.com/tidwall/tile38/pkg/geojson/geohash" + "github.com/tidwall/tile38/pkg/geojson/poly" ) // MultiLineString is a geojson object with the type "MultiLineString" diff --git a/geojson/multilinestring_test.go b/pkg/geojson/multilinestring_test.go similarity index 100% rename from geojson/multilinestring_test.go rename to pkg/geojson/multilinestring_test.go diff --git a/geojson/multipoint.go b/pkg/geojson/multipoint.go similarity index 97% rename from geojson/multipoint.go rename to pkg/geojson/multipoint.go index 3328f7c5..bc410ff8 100644 --- a/geojson/multipoint.go +++ b/pkg/geojson/multipoint.go @@ -1,8 +1,8 @@ package geojson import ( - "github.com/tidwall/tile38/geojson/geohash" - "github.com/tidwall/tile38/geojson/poly" + "github.com/tidwall/tile38/pkg/geojson/geohash" + "github.com/tidwall/tile38/pkg/geojson/poly" ) // MultiPoint is a geojson object with the type "MultiPoint" diff --git a/geojson/multipoint_test.go b/pkg/geojson/multipoint_test.go similarity index 100% rename from geojson/multipoint_test.go rename to pkg/geojson/multipoint_test.go diff --git a/geojson/multipolygon.go b/pkg/geojson/multipolygon.go similarity index 98% rename from geojson/multipolygon.go rename to pkg/geojson/multipolygon.go index af2dc96a..b1d6ed81 100644 --- a/geojson/multipolygon.go +++ b/pkg/geojson/multipolygon.go @@ -1,6 +1,6 @@ package geojson -import "github.com/tidwall/tile38/geojson/geohash" +import "github.com/tidwall/tile38/pkg/geojson/geohash" // MultiPolygon is a geojson object with the type "MultiPolygon" type MultiPolygon struct { diff --git a/geojson/multipolygon_test.go b/pkg/geojson/multipolygon_test.go similarity index 100% rename from geojson/multipolygon_test.go rename to pkg/geojson/multipolygon_test.go diff --git a/geojson/object.go b/pkg/geojson/object.go similarity index 99% rename from geojson/object.go rename to pkg/geojson/object.go index 62f52d8d..c149b419 100644 --- a/geojson/object.go +++ b/pkg/geojson/object.go @@ -6,7 +6,7 @@ import ( "fmt" "github.com/tidwall/gjson" - "github.com/tidwall/tile38/geojson/poly" + "github.com/tidwall/tile38/pkg/geojson/poly" ) const ( diff --git a/geojson/object_test.go b/pkg/geojson/object_test.go similarity index 100% rename from geojson/object_test.go rename to pkg/geojson/object_test.go diff --git a/geojson/point.go b/pkg/geojson/point.go similarity index 96% rename from geojson/point.go rename to pkg/geojson/point.go index 59dfed47..e75c8ecb 100644 --- a/geojson/point.go +++ b/pkg/geojson/point.go @@ -1,9 +1,9 @@ package geojson import ( - "github.com/tidwall/tile38/geojson/geo" - "github.com/tidwall/tile38/geojson/geohash" - "github.com/tidwall/tile38/geojson/poly" + "github.com/tidwall/tile38/pkg/geojson/geo" + "github.com/tidwall/tile38/pkg/geojson/geohash" + "github.com/tidwall/tile38/pkg/geojson/poly" ) // Point is a geojson object with the type "Point" diff --git a/geojson/point_test.go b/pkg/geojson/point_test.go similarity index 100% rename from geojson/point_test.go rename to pkg/geojson/point_test.go diff --git a/geojson/poly/LICENSE b/pkg/geojson/poly/LICENSE similarity index 100% rename from geojson/poly/LICENSE rename to pkg/geojson/poly/LICENSE diff --git a/geojson/poly/README.md b/pkg/geojson/poly/README.md similarity index 100% rename from geojson/poly/README.md rename to pkg/geojson/poly/README.md diff --git a/geojson/poly/inside.go b/pkg/geojson/poly/inside.go similarity index 100% rename from geojson/poly/inside.go rename to pkg/geojson/poly/inside.go diff --git a/geojson/poly/inside_test.go b/pkg/geojson/poly/inside_test.go similarity index 100% rename from geojson/poly/inside_test.go rename to pkg/geojson/poly/inside_test.go diff --git a/geojson/poly/intersects.go b/pkg/geojson/poly/intersects.go similarity index 100% rename from geojson/poly/intersects.go rename to pkg/geojson/poly/intersects.go diff --git a/geojson/poly/intersects_test.go b/pkg/geojson/poly/intersects_test.go similarity index 100% rename from geojson/poly/intersects_test.go rename to pkg/geojson/poly/intersects_test.go diff --git a/geojson/poly/poly.go b/pkg/geojson/poly/poly.go similarity index 100% rename from geojson/poly/poly.go rename to pkg/geojson/poly/poly.go diff --git a/geojson/poly/poly_test.go b/pkg/geojson/poly/poly_test.go similarity index 100% rename from geojson/poly/poly_test.go rename to pkg/geojson/poly/poly_test.go diff --git a/geojson/poly/raycast.go b/pkg/geojson/poly/raycast.go similarity index 100% rename from geojson/poly/raycast.go rename to pkg/geojson/poly/raycast.go diff --git a/geojson/polygon.go b/pkg/geojson/polygon.go similarity index 98% rename from geojson/polygon.go rename to pkg/geojson/polygon.go index 375b06c3..504b91cc 100644 --- a/geojson/polygon.go +++ b/pkg/geojson/polygon.go @@ -1,6 +1,6 @@ package geojson -import "github.com/tidwall/tile38/geojson/geohash" +import "github.com/tidwall/tile38/pkg/geojson/geohash" // Polygon is a geojson object with the type "Polygon" type Polygon struct { diff --git a/geojson/polygon_test.go b/pkg/geojson/polygon_test.go similarity index 100% rename from geojson/polygon_test.go rename to pkg/geojson/polygon_test.go diff --git a/geojson/position.go b/pkg/geojson/position.go similarity index 97% rename from geojson/position.go rename to pkg/geojson/position.go index 51e70dcc..a913337a 100644 --- a/geojson/position.go +++ b/pkg/geojson/position.go @@ -7,8 +7,8 @@ import ( "unsafe" "github.com/tidwall/gjson" - "github.com/tidwall/tile38/geojson/geo" - "github.com/tidwall/tile38/geojson/poly" + "github.com/tidwall/tile38/pkg/geojson/geo" + "github.com/tidwall/tile38/pkg/geojson/poly" ) const sizeofPosition = 24 // (X,Y,Z) * 8 diff --git a/geojson/simplepoint.go b/pkg/geojson/simplepoint.go similarity index 96% rename from geojson/simplepoint.go rename to pkg/geojson/simplepoint.go index 0d09ee97..fdb60d41 100644 --- a/geojson/simplepoint.go +++ b/pkg/geojson/simplepoint.go @@ -1,9 +1,9 @@ package geojson import ( - "github.com/tidwall/tile38/geojson/geo" - "github.com/tidwall/tile38/geojson/geohash" - "github.com/tidwall/tile38/geojson/poly" + "github.com/tidwall/tile38/pkg/geojson/geo" + "github.com/tidwall/tile38/pkg/geojson/geohash" + "github.com/tidwall/tile38/pkg/geojson/poly" ) // SimplePoint is a geojson object with the type "Point" and where there coordinate is 2D and there is no bbox. diff --git a/geojson/string.go b/pkg/geojson/string.go similarity index 100% rename from geojson/string.go rename to pkg/geojson/string.go diff --git a/controller/glob/glob.go b/pkg/glob/glob.go similarity index 100% rename from controller/glob/glob.go rename to pkg/glob/glob.go diff --git a/controller/glob/glob_test.go b/pkg/glob/glob_test.go similarity index 100% rename from controller/glob/glob_test.go rename to pkg/glob/glob_test.go diff --git a/controller/glob/match.go b/pkg/glob/match.go similarity index 100% rename from controller/glob/match.go rename to pkg/glob/match.go diff --git a/hservice/gen.sh b/pkg/hservice/gen.sh similarity index 100% rename from hservice/gen.sh rename to pkg/hservice/gen.sh diff --git a/hservice/hservice.pb.go b/pkg/hservice/hservice.pb.go similarity index 100% rename from hservice/hservice.pb.go rename to pkg/hservice/hservice.pb.go diff --git a/hservice/hservice.proto b/pkg/hservice/hservice.proto similarity index 100% rename from hservice/hservice.proto rename to pkg/hservice/hservice.proto diff --git a/index/.gitignore b/pkg/index/.gitignore similarity index 100% rename from index/.gitignore rename to pkg/index/.gitignore diff --git a/index/index.go b/pkg/index/index.go similarity index 99% rename from index/index.go rename to pkg/index/index.go index e33ef78b..549a618d 100644 --- a/index/index.go +++ b/pkg/index/index.go @@ -4,7 +4,7 @@ import ( "math" "unsafe" - "github.com/tidwall/tile38/index/rtree" + "github.com/tidwall/tile38/pkg/index/rtree" ) // Item represents an index item. diff --git a/index/index_test.go b/pkg/index/index_test.go similarity index 100% rename from index/index_test.go rename to pkg/index/index_test.go diff --git a/index/norm.go b/pkg/index/norm.go similarity index 100% rename from index/norm.go rename to pkg/index/norm.go diff --git a/index/rtree/rtree.go b/pkg/index/rtree/rtree.go similarity index 97% rename from index/rtree/rtree.go rename to pkg/index/rtree/rtree.go index c009e0a2..974bc537 100644 --- a/index/rtree/rtree.go +++ b/pkg/index/rtree/rtree.go @@ -1,6 +1,6 @@ package rtree -import "github.com/tidwall/tile38/index/rtreebase" +import "github.com/tidwall/tile38/pkg/index/rtreebase" // Item is an rtree item type Item interface { diff --git a/index/rtree/rtree_test.go b/pkg/index/rtree/rtree_test.go similarity index 100% rename from index/rtree/rtree_test.go rename to pkg/index/rtree/rtree_test.go diff --git a/index/rtreebase/.gitignore b/pkg/index/rtreebase/.gitignore similarity index 100% rename from index/rtreebase/.gitignore rename to pkg/index/rtreebase/.gitignore diff --git a/index/rtreebase/base.go b/pkg/index/rtreebase/base.go similarity index 100% rename from index/rtreebase/base.go rename to pkg/index/rtreebase/base.go diff --git a/index/rtreebase/base_test.go b/pkg/index/rtreebase/base_test.go similarity index 100% rename from index/rtreebase/base_test.go rename to pkg/index/rtreebase/base_test.go diff --git a/index/rtreebase/draw.go-bak b/pkg/index/rtreebase/draw.go-bak similarity index 100% rename from index/rtreebase/draw.go-bak rename to pkg/index/rtreebase/draw.go-bak diff --git a/index/rtreebase/knn.go b/pkg/index/rtreebase/knn.go similarity index 100% rename from index/rtreebase/knn.go rename to pkg/index/rtreebase/knn.go diff --git a/index/rtreebase/load.go b/pkg/index/rtreebase/load.go similarity index 100% rename from index/rtreebase/load.go rename to pkg/index/rtreebase/load.go diff --git a/controller/log/log.go b/pkg/log/log.go similarity index 100% rename from controller/log/log.go rename to pkg/log/log.go diff --git a/controller/log/log_test.go b/pkg/log/log_test.go similarity index 100% rename from controller/log/log_test.go rename to pkg/log/log_test.go diff --git a/controller/server/reader.go b/pkg/server/reader.go similarity index 100% rename from controller/server/reader.go rename to pkg/server/reader.go diff --git a/controller/server/server.go b/pkg/server/server.go similarity index 98% rename from controller/server/server.go rename to pkg/server/server.go index ec51577e..32473ff1 100644 --- a/controller/server/server.go +++ b/pkg/server/server.go @@ -11,8 +11,8 @@ import ( "time" "github.com/tidwall/resp" - "github.com/tidwall/tile38/controller/log" - "github.com/tidwall/tile38/core" + "github.com/tidwall/tile38/pkg/core" + "github.com/tidwall/tile38/pkg/log" ) // This phrase is copied nearly verbatim from Redis. diff --git a/doc/geofence.gif b/res/geofence.gif similarity index 100% rename from doc/geofence.gif rename to res/geofence.gif diff --git a/doc/logo1500.png b/res/logo1500.png similarity index 100% rename from doc/logo1500.png rename to res/logo1500.png diff --git a/doc/logo200.png b/res/logo200.png similarity index 100% rename from doc/logo200.png rename to res/logo200.png diff --git a/doc/roaming.gif b/res/roaming.gif similarity index 100% rename from doc/roaming.gif rename to res/roaming.gif diff --git a/doc/search-intersects.png b/res/search-intersects.png similarity index 100% rename from doc/search-intersects.png rename to res/search-intersects.png diff --git a/doc/search-nearby.png b/res/search-nearby.png similarity index 100% rename from doc/search-nearby.png rename to res/search-nearby.png diff --git a/doc/search-plain.png b/res/search-plain.png similarity index 100% rename from doc/search-plain.png rename to res/search-plain.png diff --git a/doc/search-within.png b/res/search-within.png similarity index 100% rename from doc/search-within.png rename to res/search-within.png diff --git a/doc/sparse-1.png b/res/sparse-1.png similarity index 100% rename from doc/sparse-1.png rename to res/sparse-1.png diff --git a/doc/sparse-2.png b/res/sparse-2.png similarity index 100% rename from doc/sparse-2.png rename to res/sparse-2.png diff --git a/doc/sparse-3.png b/res/sparse-3.png similarity index 100% rename from doc/sparse-3.png rename to res/sparse-3.png diff --git a/doc/sparse-4.png b/res/sparse-4.png similarity index 100% rename from doc/sparse-4.png rename to res/sparse-4.png diff --git a/doc/sparse-5.png b/res/sparse-5.png similarity index 100% rename from doc/sparse-5.png rename to res/sparse-5.png diff --git a/doc/sparse-6.png b/res/sparse-6.png similarity index 100% rename from doc/sparse-6.png rename to res/sparse-6.png diff --git a/doc/sparse-none.png b/res/sparse-none.png similarity index 100% rename from doc/sparse-none.png rename to res/sparse-none.png diff --git a/tests/mock_test.go b/tests/mock_test.go index 14818fa6..0641d9c5 100644 --- a/tests/mock_test.go +++ b/tests/mock_test.go @@ -12,9 +12,9 @@ import ( "time" "github.com/garyburd/redigo/redis" - "github.com/tidwall/tile38/controller" - tlog "github.com/tidwall/tile38/controller/log" - "github.com/tidwall/tile38/core" + "github.com/tidwall/tile38/pkg/controller" + "github.com/tidwall/tile38/pkg/core" + tlog "github.com/tidwall/tile38/pkg/log" ) var errTimeout = errors.New("timeout")