Commit Graph

2943 Commits

Author SHA1 Message Date
mpl 0c1b99b4c5 pkg/index: fix location in corpus to use signer ID instead of blobRef
Follow-up of ec66bcc871

Updates #537

Change-Id: Ib4dc62ae6be91c061dc6de4bfdd617785abdaab6
2018-01-23 19:11:52 +01:00
mpl 020523895a pkg/server: fix s/camlistore.org/perkeep.org/ omission
Fixes #1040

Change-Id: Idce2a376b8ee404a13ae3d25465f62dd5c98616d
2018-01-23 00:15:37 +01:00
Adam Shannon db2355bc13 sorted/postgres: create databases on boot
Previously, `create table ...` sql migrations were being made without the
database existing. This resulted in a panic and error like:

pq: database "pk_3a94488d_blobpacked" does not exist

There seems to be an upstream issue with our postgres library in which
`CREATE DATABASE ...` queries are not prepared so we have to build the
sql manually. For now I've added a regex to make sure we don't allow
anything too crazy in.

Fixes #1022

Change-Id: I0da16759e9219347bb11713b92337021546f9d57
2018-01-21 18:22:00 -06:00
Brad Fitzpatrick 87694c3ba8 Merge "all: simpify constructs by running gofmt -s on all code" 2018-01-21 19:14:54 +00:00
Adam Shannon 2b655f8855 blobserver/localdisk: check that underlying filesystem can perform operations needed
Fixes #397

Change-Id: Idc8674d13336b29eb95db4be4dd39cd557ca38e7
2018-01-21 13:10:56 -06:00
Paul Lindner 6d2d9714de all: simpify constructs by running gofmt -s on all code
Change-Id: Idc12ddcfe8f735d77c6baa942f5bb7a2c7d9b40b
2018-01-21 10:27:12 -08:00
mpl 22734c9d29 pkg/index: fix corpus tests
Follow-up of ec66bcc871

I had run the pkg/search tests to see if no high-level search was
broken, for forgot about pkg/index itself, whoops.

Change-Id: Iec3aa28aca82ac6773983ea9df9ade26a48fc4a7
2018-01-19 20:53:41 +01:00
Brad Fitzpatrick 66db09453f blobserver: add context to BlobRemover
Updates #733

Change-Id: I2fffb5cad59aa994441ee82ac5d940270113ee5a
2018-01-19 09:54:46 -08:00
Mathieu Lonjaret 4ed9175f01 Merge "pkg/index: use the gpg ID (and not its blobRef) in corpus" 2018-01-19 16:56:38 +00:00
mpl 24fa2cc781 pkg/blob: fix NewBlob doc
follow-up of 194d4f9443

Change-Id: I5cd5c1305942d883e87c0e41f8e5120994a33509
2018-01-19 17:50:19 +01:00
mpl ec66bcc871 pkg/index: use the gpg ID (and not its blobRef) in corpus
Otherwise claims that are actually from the same signer, end up being
treated as from different signers, because some of the claims were
signed by the sha1 version and others by the sha224 one.

TODO in follow-up CLs: similar fixes in rest of the corpus, such as with
claimPtrsAttrValue. See if non-corpus index functions/methods suffer
from the same problem.

Change-Id: Icbc70e97edc569f46e575d79aaf4359b33996053
2018-01-19 17:26:48 +01:00
Brad Fitzpatrick 194d4f9443 blobserver, all: add contexts to ReceiveBlob, Fetch & million resulting deps
I had intended for this to be a small change.

I was going to just add context.Context to the BlobReceiver interface,
but then I saw blob.Fetcher could also use one, so I decided to do two
in one CL.

And then it got a bit infectious and ended up touching everything.

I ended up doing SubFetch in the process by necessity.

At a certain point I finally started using context.TODO() in a few
spots, but not too many. But removing context.TODO() will come in the
future. There are more blob storage interfaces lacking context, too,
like RemoveBlobs.

Updates #733

Change-Id: Idf273180b3f8e397ac5929c6d7f520ccc5cdce08
2018-01-18 16:22:16 -08:00
mpl e9e9da4bf8 server/camlistored: use Let's Encrypt http-01 challenge
As the priority is to fix GCE instances, the port for the http-01
challenge is not configurable for now (80) even not on GCE, but it will
be in a follow-up change.

update golang.org/x/crypto/* (for acme) to rev
13931e22f9e72ea58bb73048bc752b48c6d4d4ac
update golang.org/x/sys/* to rev
fff93fa7cd278d84afc205751523809c464168ab (because unix is a dep of
crypto)

remove warning about Let's Encrypt security issue from pkg/deploy/gce

I had to manually exclude vendor/golang.org/x/crypto/acme/jws_test.go
for now because it contains a private key, and git whines about it, and
i could not override it.

Fixes #1033

Change-Id: Ie4f2049e97892dee9ab513300a5f12e64976aec8
2018-01-16 23:43:13 +01:00
Paul Lindner b88b82f1ee all: convert imports of golang.org/x/net/context to context
Change-Id: I01cfa903ab2b97a1ad3ea57eb29fe88819216a3f
2018-01-13 16:37:49 -08:00
Brad Fitzpatrick 7f42eef7b3 Merge "pkg/blobserver/union: add "union" blobserver type" 2018-01-13 20:42:16 +00:00
Paul Lindner 990b613e2e pkg/test/integration: fix websocket integration test failures
In rev: 837fe8ac46 a new
version of websocket was imported and changes were made to use
origin checking.  This integration test was missed during those
changes.

This change fixes this test and adds the origin data to the
request, uses the correct 'ws' scheme and uses the new Dialer
API to make requests.

Change-Id: I93e8228794665012f15370532cdeda3cb702ea00
2018-01-12 06:24:38 -08:00
Tamás Gulácsi 2ba0c43003 pkg/blobserver/union: add "union" blobserver type
This blobserver is just "cat"ing the given "read" storages.
This is read-only, so you should use some other storage to augment this for
writing and removing - for example the "cond" storage is perfect for this.

My use-case is to use blobpacked with large=diskpacked, small=filesystem,
but consolidate the small blob storage into a diskpacked + filesystem
after the filesystem becomes huge.

Another use-case is joining separately built camlistore servers into one.
(For me, they have to be separated later, so I've built them separately,
but I've to use it joined for a month).

Change-Id: I4e7e42cd59286f0f34da2f6ff01e44439771d53c
2018-01-12 06:54:24 +01:00
Paul Lindner 32e37c926d Merge "vendor: Update github.com/gorilla/websocket to v1.2.0" 2018-01-11 21:26:51 +00:00
Paul Lindner 837fe8ac46 vendor: Update github.com/gorilla/websocket to v1.2.0
Maps to rev: gorilla/websocket@ea4d1f681b

Also adjust the search websocket code to use the new API
which does proper origin checks.

Changelog: https://github.com/gorilla/websocket/releases/tag/v1.2.0

Change-Id: Ie25490b6319a98345aa6272e9eabc35c298bc06d
2018-01-11 10:42:39 -08:00
mpl c42fd33f51 pkg/deploy/gce: warn about autocert being broken
Fix s/Camlistore/Perkeep/ while we're there.

Change-Id: Ifce76b77ce04af8952e37953e1646ee785e9d09d
2018-01-11 01:22:44 +01:00
mpl 392f8269a5 server/camlistored: update embed dir location
Follow-up of 463832ed76

fixes #1032

Change-Id: Ib5789fce5620bed2a3251afc947a0bc0bcfd3f41
2018-01-10 20:18:19 +01:00
Brad Fitzpatrick 38f10a7bd0 all, testhooks: use sha224 by default, add hook for some tests to use sha-1
Remove the blob.SHA{1,224}From{Bytes,String} constructors too. No
longer used. This adds blob.RefFromBytes which was missing. We had
blob.RefFromString. Now everything uses blob.RefFrom* instead of
specifying a hash function.

Some tests set a flag to force use of SHA-1 because there was too much
golden data to update. We can remove those one-by-one over time as we
fix up tests.

Updates #537

Change-Id: Ibe6428089a6221594c2b751f53f98b03b5a28dc2
2018-01-09 20:03:38 -08:00
Paul Lindner 67ad77491c pkg/serverinit: improve error message to help people find config file with errors
Change-Id: I5a09a50a1fbdaea0f83dc9a586c65b83e0160f53
2018-01-09 23:12:37 +00:00
Brad Fitzpatrick 6bb4cc91ba pkg/blobserver/mongo: fix stat behavior on missing blob
Tests pass now.

Change-Id: Ib98ca8c213b638a79bfd61f1b7739459b3fd03da
2018-01-09 15:12:05 -08:00
Paul Lindner 463832ed76 clients/web/embed: Move vendor/embed to clients/web/embed and adjust paths
Addresses #889
Fixes #1024

Change-Id: I9fa1dc246b0a3a1a4e4ec7abab0a7828fdfdb41e
2018-01-09 22:33:03 +00:00
Brad Fitzpatrick 0e8980b54b blobserver: change BlobStatter interface, simplify proxycache
This addresses a long-standing TODO in the BlobStatter interface to
clean it up. Just like all new Go programmers, I misused channels in
APIs. I should've cleaned this up years ago.

While here, I also added a context.

The rest should get contexts later.

This also cleans up a few things here & there.

The pkg/client statting no longer does batching, which added a lot of
complexity. There was a comment saying something like "once we have
SPDY, we can delete this". Well, we have HTTP/2 now, so seems
deletable.

All tests pass.

Change-Id: I034ce07d9b70e5cc9e5482213368993e638d4bc8
2018-01-08 16:54:52 -08:00
Brad Fitzpatrick 27bacd3df1 pkg/blob, all: support SHA-224 blobrefs, make them the default
Updates #537

Change-Id: I3966697cbdb05ca4b380974be604deebdaa258c2
2018-01-08 16:34:41 -08:00
Brad Fitzpatrick 617ac40512 all: rename cammount to pk-mount
Updates #981

Change-Id: Ie1d2e3c0fd7e2b7a7801ceac0fd8f93f62d56651
2018-01-08 09:54:41 -08:00
Brad Fitzpatrick 01419ae02d pkg/test/integration: skip non-UTF-8 test on filesystems requiring UTF-8
Fixes #1025

Change-Id: Ia6212140197958ef6660bf3ced6a9bb427ae5aef
2018-01-08 06:47:16 -08:00
Brad Fitzpatrick 9265c980de all: change github.com/camlistore/camlistore to github.com/perkeep/perkeep
Change-Id: I0d612bf450e9e8d9ce0767c5a0cb0c44c0d8704f
2018-01-05 19:49:59 -08:00
Mathieu Lonjaret a2135d90a6 Merge "pkg/serverinit: keep DBNames compatibility for existing GCE instances" 2018-01-05 20:54:56 +00:00
mpl 7ea897cd84 pkg/serverinit: keep DBNames compatibility for existing GCE instances
followup of 7eda9fd502

We want existing Perkeep instances on GCE to be able to keep on running
with their DBNames-style existing databases.

To that end, we introduce the "perkeep-config-version" metadata key,
which will be set by the launcher from now on.

When perkeep configuration starts, it can lookup that key. If it is set,
it means we're in a newly created instance, and we don't need to care
about DBNames compatibility. If not, we modify the low level
configuration on the fly, so that it keeps on using the old DBNames
values that were set for a GCE instance.

Change-Id: I611811fdb9c68777c2ba799e9047d00ec0bae040
2018-01-05 21:52:42 +01:00
mpl 4ca45d928b misc/docker/dock.go: update to build from perkeep.org
Change-Id: Ie2a995c603a7714979d9967964e6b4c83f4886d4
2018-01-05 20:34:17 +01:00
Brad Fitzpatrick ed07089172 Merge "cmdmain: sort Modes and Examples" 2018-01-04 04:59:27 +00:00
Adam Shannon 02fc19475c cmdmain: sort Modes and Examples
Fixes #1002

Change-Id: Icd8d2727dbdd73e85a05450278eb9f25f4a49121
2018-01-03 21:55:01 -06:00
mpl 7eda9fd502 pkg/serverinit: remove DBNames and provide consistent default instead
DBNames is supposed to provide configuration for the various databases
names. However,
1) I contend that nobody needs or wants to configure them as long as we
provide sane defaults.
2) it seems the only obvious user we have for this is to set up some of
the names on GCE.
3) having another external source for names complicates the code
further, especially when we already have the distinction between
database names for DBMS and file names for file-based databases.
4) writing a correct documentation for it is awkward.

Therefore, in this CL, I propose that we remove DBNames. Instead,
genconfig.go now sets some consistent default names for the various
queues and indexes set up on a DBMS (MySQL, PostGres, Mongo). To that
end, we introduce the new, but optional, DBUnique configuration
parameter, that is used as a part of all the database names, in order to
be able to run several Perkeep instances on the same DBMS, without name
conflicts.

In addition, the queue for the bs->index synchandler is now set up on
the same DBMS that is already in use for the index itself, instead of
using a file-base database.
And i think we could proceed likewise for the other queues.

Fixes #951

Change-Id: Ib6a638f088a563d881e3957e4042e932382b44f4
2018-01-04 04:01:34 +01:00
Brad Fitzpatrick 57648c6b83 all: update copyright holder from Google Inc to The Perkeep Authors
The AUTHORS file is the list of copyright holders.
2018-01-03 16:52:49 -08:00
Paul Lindner d5b55e51a8 Merge "all: update mongo to latest version" 2018-01-03 21:04:12 +00:00
Paul Lindner 49b1af4a1b all: update mongo to latest version
The mongo integration was using a very old package.  It's using
a new namespace now.  Upgrade and adjust all call points

Removes labix.org/v2/mgo

Introduces gopkg.in/mgo.v2 from branch v2 with revision
  3f83fa5005286a7fe593b055f0d7771a7dce4655

Change-Id: I2784fca941998460f58e0ac8d3d51286401590b5
2018-01-03 10:49:07 -08:00
mpl b5b668b661 pkg/client: force nil transport when on the browser
Calls to net.Dial* are prohibited with GopherJS. This can happen if the
client's transport is set by the user.

This change forces transportForConfig to return nil when the client
package is compiled with gopherjs, in order to make sure that a call to
newClient returns a client with a nil transport.

Change-Id: I577457bd7d924d31710168086dc2b394df3d1ae0
2018-01-03 16:38:47 +01:00
Brad Fitzpatrick eb0024f164 Merge "pkg/index: ignore unset msdos time when possible" 2018-01-03 06:18:09 +00:00
Brad Fitzpatrick 8a0a3e8649 Rename camdeploy to pk-deploy.
Updates #981

Change-Id: I4c6c16135f3239bb4b8d2d187e9537a4abf7a3fe
2018-01-02 22:10:37 -08:00
Brad Fitzpatrick c3d05cdce9 Move more packages out of pkg/ and into internal/
Moved hashutil, httputil, osutil, netutil,
images, media, magic, video, and rollsum.
2018-01-02 21:03:30 -08:00
Brad Fitzpatrick e093206a2a doc: add jsonsign protocol docs
And misc tweaks.

Updates #1009
Updates #1007

Change-Id: Ibb750c8cc69763c0a59b72f42bc53f68e3ee120f
2018-01-02 19:24:58 -08:00
Josh Bleecher Snyder 7ac7a50f61 rollsum: help the compiler
With Go master (roughly Go 1.10):

name       old time/op   new time/op   delta
Rollsum-8   39.0ms ± 2%   22.2ms ± 2%  -42.93%  (p=0.008 n=5+5)

name       old speed     new speed     delta
Rollsum-8  135MB/s ± 2%  236MB/s ± 2%  +75.23%  (p=0.008 n=5+5)

Change-Id: Ic933f8ee5f1ffaada8e37c8ac19edb7d6c0fc57d
2018-01-02 12:24:53 -08:00
Brad Fitzpatrick 11e9c5567c Move some packages from perkeep.org/pkg to perkeep.org/internal
Notably: pkg/misc all moves.

And pkg/googlestorage is deleted, since it's not used. Only the
x/net/http2/h2demo code used to use it, but that ended in
https://go-review.googlesource.com/33230 (our vendored code is old).
So just nuke that dir for now. When it's refreshed, it'll either be
gone (dep prune) or new enough to not need googlestorage.

Also move pkg/pools, pkg/leak, and pkg/geocode to internal.

More remains.

Change-Id: I2640c4d18424062fdb8461ba451f1ce26719ae9d
2018-01-01 20:54:48 -08:00
Brad Fitzpatrick 930f049ec9 Merge "website: make camlistore.org go-import meta tags reference a snapshot" 2018-01-02 00:42:06 +00:00
Brad Fitzpatrick 39d904c186 Merge "Rename import paths from camlistore.org to perkeep.org." 2018-01-02 00:41:55 +00:00
Mathieu Lonjaret f75df9284a Merge "pkg/deploy/gce: add Google Cloud Free Tier option" 2018-01-02 00:37:48 +00:00
Brad Fitzpatrick d6a0b05df0 Rename import paths from camlistore.org to perkeep.org.
Part of the project renaming, issue #981.

After this, users will need to mv their $GOPATH/src/camlistore.org to
$GOPATH/src/perkeep.org. Sorry.

This doesn't yet rename the tools like camlistored, camput, camget,
camtool, etc.

Also, this only moves the lru package to internal. More will move to
internal later.

Also, this doesn't yet remove the "/pkg/" directory. That'll likely
happen later.

This updates some docs, but not all.

devcam test now passes again, even with Go 1.10 (which requires vet
checks are clean too). So a bunch of vet tests are fixed in this CL
too, and a bunch of other broken tests are now fixed (introduced from
the past week of merging the CL backlog).

Change-Id: If580db1691b5b99f8ed6195070789b1f44877dd4
2018-01-01 16:03:34 -08:00
mpl c366c68a84 pkg/blobpacked: adjust tests for rollsum change
After the rollsum fix in 4723d0f452
landed, the way files were truncated in blobs changed, and hence some
expected hashsums as well.

This CL adjusts such expectations.

Change-Id: I44fc1f5ce1922d7bc99f9a8096ef4b8d212571dc
2018-01-02 00:33:47 +01:00
mpl b71aa74f31 pkg/blob: add ref.HasPrefix method
Continuation of 504604e22d

Needed by #972

Change-Id: Ia4873aba5d1b1be7774ce38eeff15761961b41d7
2018-01-01 19:43:15 +01:00
Brad Fitzpatrick 26e0ff0c96 Merge "blobserver/blobpacked: log reindexing progress" 2017-12-31 02:05:45 +00:00
Brad Fitzpatrick 9ca28d644b Merge "pkg/serverinit: on GCE, reset name if instance name is in camlistore.net" 2017-12-31 02:04:05 +00:00
Brad Fitzpatrick d423b811be Merge "pkg/index: move reindex success msg to later" 2017-12-30 17:12:46 +00:00
Brad Fitzpatrick f164f43cf3 Merge "pkg/importer/picasa: better tests" 2017-12-30 06:44:28 +00:00
Tamás Gulácsi f54c06afd9 pkg/importer/picasa: better tests
Add more thorough testing for importAlbums.

Change-Id: Id5f139052464113fa1194fccb39b81277361e514
2017-12-30 06:44:21 +00:00
Steven L. Speek 13c084739c search: expression/constraint aliases
The search handler can store and retrieve search aliases.
Keyword namedSearch handles these new atoms of the form
named:foo.

Creating an alias has been implemented using a client in
the camtool subcommands named-search-get and named-search-set.

Change-Id: I7960f83bad464eb1a971c07f33631744a5eea814
2017-12-29 21:41:20 -08:00
Hernan Grecco 2df2ac4f1d pkg/fs: implement magic folder "versions" in fuse
A file is shown as folder and inside you can see all its versions (named according
to the date). Basically is like `at` but the path (not the date) goes first.

So if you go to:

    $ ls  <mountpoint>/versions/my_folder
    dr-x------  1 grecco  32000  0 Mar 13 01:39 my_file

and then:

    $ ls  <mountpoint>/versions/my_folder/my_file
    -r--------  1 grecco  32000   2 Mar 13 01:39 2014-03-12T14:53:34.471588505Z
    -r--------  1 grecco  32000   2 Mar 13 01:39 2014-03-12T14:53:36.6569929Z
    -r--------  1 grecco  32000   2 Mar 13 01:39 2014-03-12T14:53:38.842875168Z
    -r--------  1 grecco  32000  25 Mar 13 01:39 2014-03-12T21:16:09.905612807Z

These files are standard files which can be opened to see the file content as a
specific point of time.

Change-Id: I38a4d7bf35ba32407036535e629039e23dc32735
2017-12-29 20:52:38 -08:00
Brad Fitzpatrick b9a68c3000 website: make camlistore.org go-import meta tags reference a snapshot
I created https://github.com/camlistore/old-cam-snapshot with a snapshot
of our git repo before we start rearranging things.

This way we won't break anybody depending on camlistore.org/* Go
packages after the move. They just won't get any updates. Actually
things will probably break if they run "go get -u". Need to
investigate what happens there.

Change-Id: I45e109c18323e65bd76706faa08d955dcbc5f6c6
2017-12-29 18:20:09 -08:00
Markus Peröbner ca3118aa12 pkg/blobserver/remote: adds trusted certs option to remote blobserver
Allows to use self signed certificates with https endpoints.

Change-Id: I1e15bbf15b89e57c8a8cfaf85d778d912a3cc36e
2017-12-29 14:47:37 -08:00
Filippo Valsorda d388cab373 blobserver/encrypt: implement meta blob packing
Keeping it simple: every time a new meta blob is added, Push it into a
heap, if the heap gets too long, Pop out all the blobs, pack them,
upload the new one and delete the olds.

The Push and Pop operations are done under Lock, packing, uploading and
deleting in a goroutine.

Meta blobs can't get bigger than twice the full size.  Packing happens
on average <max heap length> times before filling a blob because blobs
are added as single-lines.  This means uploading approximately
    <max heap length> * <full size> / 2
bytes of blobs that will be removed for each full size blob.

At start, push all non-full meta blobs, so that we do packing that might
have failed previously.

Change-Id: I1f2fbfc802c1b82dcc87fc0b333c30949229c928
2017-12-29 14:18:57 -08:00
Filippo Valsorda f9cfd754a2 blobserver/encrypt: rewrite encryption to use NaCl and a simpler meta
NaCl offers authenticated encryption, which means that the blobstore
can't tamper with the data.  Since SHA-1 were checked one could not
change a blob outright, but could add new blobs by tampering with the
meta blobs, too.  It's true that only signed blobs should cause actions
just by being present, but we are already far too deep in the chain of
assumptions, just not to spend a bit of CPU adding a MAC.  The new
scheme is much easier to prove secure.

Also simplified the meta by removing the IV (which is in the encrypted
blob anyway) and the encrypted size (which is plaintext size + overhead).

Finally, added tests (including a storagetest) and tried to make this
sort of production-ready.

Still to do are meta compaction and a way to regenerate the meta from
the blobs, in case of meta corruption (which now we can do securely
thanks to NaCl authentication).

golang.org/x/crypto/nacl/secretbox:
golang.org/x/crypto/poly1305:
golang.org/x/crypto/salsa20/salsa:
golang.org/x/crypto/scrypt:
golang.org/x/crypto/pbkdf2:
	1e61df8d9ea476e2e1504cd9a32b40280c7c6c7e

Change-Id: I095c6204ac093f6292c7943dbb77655d2c51aba6
2017-12-29 14:16:34 -08:00
Piotr S. Staszewski c0ba41fbce magic: add file types and tests
Additional mappings (taken from the file utility source code) and
test cases. Included file license.

Change-Id: I1dadff94c7c7d5280e12d82da61b7159f29eabe3
2017-12-29 13:01:05 -08:00
Govert Versluis 8548962dbe Add Azure blobserver support.
Fixes #425

Change-Id: I02bb29e6503bfef0894cbfde0c2a3304cf70c932
2017-12-29 12:39:49 -08:00
Tamás Gulácsi 4754ab6c4b pkg/blobserver/diskpacked: fail earlier in StreamBlobs
As Miki Habryn suggested at
https://groups.google.com/forum/#!topic/camlistore/WmUyUWMfZx0%5B1-25%5D

Change-Id: Ib910e5bcfa7eb33360f7b5e1085bd9bb1f0e9e6a
2017-12-29 12:19:25 -08:00
Brad Fitzpatrick 815575e493 Merge "pkg/rollsum: fix uint8 overflow" 2017-12-29 19:41:36 +00:00
Tamás Gulácsi 2329b8038c blobserver/diskpacked: fix missing Close on Seek error
Fixes #667

Change-Id: I11eaa2cc21bfbc825b14cc91208fd8ebc9e7418e
2017-12-29 11:29:09 -08:00
Brad Fitzpatrick 956a0a810b pkg/blobserver/localdisk: simplify code, limit stat concurrency
Don't create an unbounded number of stat goroutines.

Change-Id: Ie66cc9c680bd83e649966258a8e7ef09c8af5c62
2017-12-29 11:22:47 -08:00
Daniel Heath 59ac14caa5 Vendor OpenSans (apache 2 licence)
Change-Id: Ie74b37efc007011b32810fd91c65b7750588a76e
2017-12-29 10:22:49 -08:00
Stephen Searles 6b426cb10d improve proxycache and stats blobservers
improving proxycache
- added fuller sample config to the package documentation
- switched the stats caching from sorted.kv to the stats blobserver
- added a cleaning mechanism to evict the least recently used blobs
- implemented StatBlobs to actually inspect the local cache. It still
  always consults the origin, but only for the blobs necessary after
  giving the cache a 50ms headstart.
- logging a few errors that were previously ignored
- added tests modeled after the tests for the localdisk blobstore
- added a method to verify the cache, and call it on initialization
- added a strictStats option to always get stats from the origin
- filling in cacheBytes on initialization

improving stats blobserver
- implemented a few more of the blobserver interfaces, Enumerator and
  Remover
- Fixed a bug(?) in ReceiveBlob that seemed to prevent it from actually
  storing stats
- added a test

minor improvements include:
- blobserver/memory: allowing the memory blobserver to hold actually
  infinite items, if desired
- blobserver: closing dest in the NoImpl blobserver, as required by the
  BlobEnumerator interface
- storagetest: not closing dest leads to deadlock
- lru: max entries of 0 now means infinite (maybe do anything <0?)
- test: a helper function to create a random blob using a global random
  source that is, by default, deterministic, to make test results more
  consistent.

In the future, an improved BlobHub or similar interface could allow a
tighter feedback loop in providing cache consistency. i.e. the cache
could register with backend stores to be notified of content updates,
minimizing the time between backend changes and cache correction.

The proxycache will verify itself at startup, reporting an error if
any of its blobs do not exist in the backend storage or if the backend
storage has a different size for the content than the cache.

Fixes #443

Change-Id: I9ee1efd8c1d0eed49bb82930c2489a64122d3e00
2017-12-29 10:09:15 -08:00
Brad Fitzpatrick f4b62de003 Merge "pkg/client: set ServerName before DialTLS handshake for android" 2017-12-29 15:52:40 +00:00
Brad Fitzpatrick 504604e22d blob: add Ref.EqualString method
Adds allocation-free way to check if a blob ref is equal to its
stringified form.

For #972 (doesn't fix it, as that bug is about a pending CL)

Change-Id: I49c6dee162698d38bb12314623b1507ee7bb246e
2017-12-26 17:37:00 -08:00
Paul Lindner b077a5916e pkg/webserver: remove usage of the obsolete runsit package
The runsit package is obsolete.  Pull the listen code directly into webserver and
remove support for the runsit specific named ports.  Update TODO.

Change-Id: I0d8ea798375d0eb4abea86ed9e6454376233e992
2017-12-26 15:03:59 -08:00
mpl 8b2e541731 pkg/client: set ServerName before DialTLS handshake for android
Otherwise, the android app fails to connect with a server that uses
Let's Encrypt (because it relies on SNI, which requires the ServerName
to be set).

Change-Id: I9f25486bea68e83c68584a83817c98bfc84f62b9
2017-12-22 19:02:47 +01:00
Brad Fitzpatrick 8e02a79b5b osutil: add func to report whether the secret-keyring flag is loaded
Then use it in pkg/client and remove the workaround from cmd/pk-devimport.

Change-Id: Iebd380d8c021628ac5e52219d00cfdf8e03f6b7d
2017-12-20 12:53:22 -08:00
Brad Fitzpatrick 393294643b Merge "cmd/pk-devimport: command that runs a local importer" 2017-12-20 20:03:45 +00:00
mpl 99e71732b9 cmd/pk-devimport: command that runs a local importer
Change-Id: I62e35db0040cda51f2bc5ede4560974e3f3442cc
2017-12-20 17:58:56 +01:00
Paul Lindner d81b001d24 cmd/cammount: add more documentation and examples to help people get started with PerkeepFs
Fixes #789

Change-Id: I9f0d0a8a823902ed2ae1bf83d4a5b58fadac1d7d
2017-12-19 15:32:33 -08:00
Mathieu Lonjaret ee580cd5f5 Merge "pkg/deploy: ignore Domain field from page template" 2017-12-18 15:16:53 +00:00
Brad Fitzpatrick 95e119f16f importer/gphotos: don't return channels in internal API, use foreach funcs
This code previously had methods returning channels. Such APIs are
always error-prone and difficult to use. Switch to a synchronous func
callback pattern instead, with contexts propagated.

Change-Id: Iaa1b91227c0daf4c8562fcba8d27dbcd7ab755c5
2017-12-17 17:43:23 -08:00
Brad Fitzpatrick ac517f7b75 Merge "importer/gphotos: more little cleanups" 2017-12-17 20:06:24 +00:00
Brad Fitzpatrick 77a37d01b3 importer/gphotos: more little cleanups
Change-Id: Ia97d56eb3e3f302f60c30af08a220cfa011936e2
2017-12-17 08:29:50 -08:00
mpl 253e7cb5d4 pkg/deploy: ignore Domain field from page template
Fixes #985

Change-Id: If110d392885fb89d0403ab9eb3aaf8dcdc3fe249
2017-12-16 02:01:36 +01:00
mpl c45893a69b importer/gphotos: add enabling Drive API to instructions
Fixes #984

Change-Id: I12126318cf836536306fd7a861a730fc3196c7b7
2017-12-15 19:08:51 +01:00
Brad Fitzpatrick fcd5ff14e9 importer/gphotos: misc rate limit cleanups
Remove dynamic rate limit adjustment for now. It was racy.

No need to be super fast, anyway, as long as it catches up eventually.

But we can make it smarter later. I wanted to get it correct first.

Change-Id: Id5b5fc946546d8d9c0720f1c0ec2f341a17cdd01
2017-12-14 22:16:57 -08:00
Paul Lindner 7ae6e00368 pkg/serverinit/testdata: fix tests broken by changing error message for golint
Change-Id: Id48a2ebaed056e50f1ac6b34c4869b07590d55d3
2017-12-13 11:33:30 -08:00
Paul Lindner 04b9c0b1c4 pkg: lint fixes for "context.Context should be the first parameter of a function"
Change-Id: I0185eec5616c72d859978aec03880860421c7193
2017-12-13 11:33:21 -08:00
Paul Lindner 1383869054 all: lint fixes for "receiver name should be consistent with previous receiver name"
Change-Id: I05275cd20c92349e37365e2cbd29fa9f8d834101
2017-12-13 11:31:25 -08:00
Paul Lindner c58e07942e all: lint fixes for "if block ends with a return statement"
Change-Id: I1c244f14995478860c19695695f287d541a7a39c
2017-12-13 11:31:25 -08:00
Paul Lindner 1533d9822f pkg: lint fixes for "error var should have name of the form errFoo"
Change-Id: I0112c331b9f54f271c3724c3ad510a1426f710d4
2017-12-13 11:31:25 -08:00
Paul Lindner ba92702834 all: lint fixes for "should omit 2nd value from range"
Change-Id: I7bb19d376f96a39ecae7dbdb4d6808f704bae5fb
2017-12-13 11:31:25 -08:00
Paul Lindner e97eae91dc all: lint fixes for "don't use leading k in Go names"
Change-Id: I8647c1dcc0535b1fc8dc0e1b1ca4623c23d6ac7c
2017-12-13 11:31:25 -08:00
Paul Lindner e028e3d7cd Merge "all: lint fixes for 'error strings should not be capitalized or end with punctuation or a newline'" 2017-12-11 21:29:14 +00:00
Mathieu Lonjaret 527d42eb03 Merge "genfileembed: always embed paths with slashes" 2017-12-11 17:40:23 +00:00
Paul Lindner 15feaeb24c all: lint fixes for 'error strings should not be capitalized or end with punctuation or a newline'
Change-Id: I9c3766a51ac8be694ae76befff4b6fa9a85e34eb
2017-12-11 06:13:25 -08:00
Paul Lindner b9c2da7032 all: replace usage of deprecated oauth2.NoContext with context.Background()
Change-Id: I4fdc9719911498dc6864b4f0189ab8b01db68308
2017-12-09 14:48:53 -08:00
Attila Tajti f47366c659 genfileembed: always embed paths with slashes
Also change make.go to propagate -all to genfileembed.

Fixes #982

Change-Id: I605d5fc35ae0fc9c12fca639ff0a0111836b653c
2017-12-08 09:24:14 +01:00
Paul Lindner be2dd5ee43 pkg/deploy/gce: use a single append to concatenate two slices
Change-Id: I3e4e0a8f9e934007513737155d15ee03494ccf6b
2017-12-05 11:30:41 -08:00
Paul Lindner 4bb1f42d5f pkg: simplify code - the make function defaults capacity == length, and replace usage of string(buf.Bytes()) with buf.String()
Change-Id: I3ddd3e139b46af1f7166c16e747e52cab0955064
2017-12-05 11:28:59 -08:00
Paul Lindner 680b296c2e pkg: simplify code - use time.Until and time.Since
Change-Id: I9c023bd4bb312e05bfbd6b1e33425500bbc5aada
2017-12-05 11:22:37 -08:00
Paul Lindner d822385502 Simplify: use increment operators
Change-Id: I5e89211aa5f3423fabcabeebabc4db5fb1812191
2017-12-04 14:41:36 -08:00
Paul Lindner a92f5ddfc8 Use io.Seek* constants instead of deprecated os.SEEK* constants
Change-Id: I4cc06bdcec87df16663981479d71e5732cdfb7d4
2017-12-03 17:04:02 -08:00
Paul Lindner 1afc3450c2 Remove blank line in blobpacked to apply comments to the package
Change-Id: I040cd9e36584c7b17b809691495f81295733c6a1
2017-12-03 17:01:29 -08:00
mpl a91a98c58a pkg/test: remove FakeIndex
And fix its main users: tests in pkg/search.

Fixes #883

Change-Id: Ib04b8d6f2d56bfb24a8900520c97b24bccb3c78b
2017-12-01 19:59:26 +01:00
Paul Lindner b09cd377d7 Switch to stdlib context from golang.org/x/net/context
This switches most usages of the pre-1.7 context library to use the
standard library.  Remaining usages are in:

  app/publisher/main.go
  pkg/fs/...

Change-Id: Ia74acc39499dcb39892342a2c9a2776537cf49f1
2017-11-26 01:12:26 -08:00
Mathieu Lonjaret c4d3a2b973 Merge "pkg/cmdmain: set flag.CommandLine output to Stderr" 2017-11-20 21:59:32 +00:00
mpl 960d5fd76e pkg/cmdmain: set flag.CommandLine output to Stderr
Otherwise the calls to flag.PrintDefaults would print to os.Stderr
instead of cmdmain.Stderr.

Change-Id: Iaad0884b5d583ff808e8129671d274601aa401cb
2017-11-20 21:14:27 +01:00
Paul Lindner 141328c697 vendor: update qr package
to Rev 48b2ede4844e13f1a2b7ce4d2529c9af7e359fc5

The qr package has moved from code.google.com/p/rsc/qr to it's new
canonical home at rsc.io/qr

Change-Id: Ibb04ee7e83c9707ff253a91abb4f60f9b150d61c
2017-11-20 12:08:08 -08:00
Paul Lindner 3654a0f623 vendor: update go-charset, atom, html, text packages
to Rev 9dfe39835686865bff950a07b394c12a98ddc811 for golang.org/x/html
to Rev 88f656faf3f37f690df1a32515b479415e1a6769 for golang.org/x/text

These packages moved from code.google.com to their new home
in golang.org/x/html and golang.org/x/text

Change-Id: I4ee45ae1e18eb05ef7b0a8ec69e2f1f11d140340
2017-11-20 10:37:56 -08:00
Paul Lindner b24717a83f vendor: update xsrftoken
To rev 9dfe39835686865bff950a07b394c12a98ddc811

The xsrftoken package now lives in golang.org/x/net instead of code.google.com.

Change-Id: I4d98b1e50099dc7a1e1188f5c4311cd28c79f44a
2017-11-20 08:47:16 -08:00
mpl e8077cba6e pkg/search: print describe speed only in debug
Change-Id: I4f22ccf907702b2d2bc7ada06af7ef85b2f1963a
2017-11-17 17:42:01 +01:00
mpl 28bc007676 pkg/serverinit: add low-level config generation for Backblaze B2
Fixes #971

Change-Id: Iba944e3597009b18a380007b72fba5127e9a1698
2017-10-26 19:59:01 +02:00
Mathieu Lonjaret 3911a41bd5 Merge "cmd/*: always output on fatal errors" 2017-10-22 15:07:06 +00:00
mpl a6a3cac0df cmd/*: always output on fatal errors
This CL addresses issues #685 and #862.

The general problem is that some critical errors, that lead clients such
as camput to exit with failure, are not displayed when not running in
verbose mode.

The reason that happens is because of code such as:

	if *cmdmain.FlagVerbose {
		log.SetOutput(cmdmain.Stderr)
	} else {
		log.SetOutput(ioutil.Discard)
	}

which means that in non-verbose mode we discard absolutely all log
messages, even those that would be printed during a Fatal* call.

To address that problem, we introduce a logger, as well as the Printf
and Logf functions using it, in pkg/cmdmain. These two functions only
output when *cmdmain.FlagVerbose is true.

Commands such as camput or camtool should now always:
1) log.SetOutput(cmdmain.Stderr) in init().
2) use log.Printf for messages that should always be printed.
3) use cmdmain.Printf/Logf for messages that should only be printed when
*cmdmain.FlagVerbose is true.
4) use log.Fatal for critical errors.
5) optionally, set the Verbose and Logger of the client(s) they are
using.

Also, camput and camtool are now relying on the global -verbose flag
from cmdmain, instead of having to define one for each subcommand.

fixes #685
fixes #862

Change-Id: I088032fd28184a201076097bf878894b22a8a120
2017-10-19 02:22:44 +02:00
Daniel Lipovetsky 493cc283d2 website: update help page community URL
Remove the trailing slash from the community URL

Fixes #967

Change-Id: I487eaa71d6a1536293c6aa655dc280d9f2cdb276
2017-10-16 22:55:30 -07:00
mpl 4784b22aeb pkg/serverinit: on GCE, reset name if instance name is in camlistore.net
On GCE, on startup, we did not set the camliNetIP in the high-level
config if the camlistore-hostname instance var vas already set.

The camliNetIP presence in the config is the signal for the server
that it should be configured as part of camlistore.net (and in
particular that it should update the record for its name on the
camlistore.net DNS server). Part of this configuration is to set the
camlistore-hostname var for the instance.

Therefore, a server which had been configured once as described above,
would not, on a subsequent restart, behave as if part of camlistore.net
and would skip the related configuration code path. Unless the
camlistore-hostname var was manually wiped before restart.

As this manual step is not an obvious one, this CL changes the
initialization, so that if a camlistore-hostname var is set, but the
value is a subdomain of "camlistore.net", the var is treated as empty
and initialization proceeds as if with a new server.

Fixes #963

Change-Id: Iab70185d7b90ef7e70bb831d363ff9d525922e35
2017-10-04 17:36:02 +02:00
mpl 52b139ea6c vendor: update Google Closure
To rev 37a4c36ce6286bb78bceb20579fecdfe7a759e02

Fix vendor/embed/closure/updatelibrary.go to now fetch from github.
Fix pkg/misc/closure/gendeps.go to work with new addDependency calls.

Fixes #903
Fixes #961

Change-Id: Ie555cf9bf5a8624845095fb3351482a690a2571c
2017-10-03 17:33:49 +02:00
mpl a3bbb6ca3d pkg/importer/allimporters: enable gphotos
Change-Id: I4ea6d12c7d41d64e55654e9a539aaa62e9473d73
2017-09-21 01:41:19 +02:00
mpl e4371187bf pkg/index: move reindex success msg to later
The message was getting printed before some potential errors could still
occur during reindexing.

Issue #954

Change-Id: I952fe7b92045ad85681cb63b7fb13803d5c43004
2017-09-19 00:36:15 +02:00
Ronald Evers 9ab1799c84 pkg/types/camtypes: fix a typo
Noticed this typo at http://localhost:3179/?camli.mode=config.

Change-Id: Ide8868fbef10dbb16f85ef53db02d4bf769cfd35
2017-09-17 17:05:43 +02:00
mpl 4a8e6f03b5 pkg/index: add simple integrity check
This change adds a check right after index initialization that
enumerates blobs for a few seconds and verifies that all of them are
indexed.

A warning is logged if any of the blobs are not found in the index.

Issue #947

Change-Id: Idc0df2121c1fb58e7560173b7753eaaddc4e653b
2017-09-15 15:52:58 +02:00
Paul Lindner fa46c3935d Correct various misspelled words
Change-Id: I236e880526e4c2b0bd318da041983d557e0aa885
2017-09-11 08:33:31 -07:00
mpl fdf50ad339 pkg/deploy/gce: update GCE API service name
Fixes #943

Change-Id: I676b76dc6b7e25bb5c418150aedf2766a1089ee8
2017-09-07 16:24:00 +02:00
Mathieu Lonjaret 4e6d89caf7 Merge "pkg/serverinit: catch typos in high-level server config" 2017-09-06 16:32:20 +00:00
mpl d982e37c4a pkg/serverinit: catch typos in high-level server config
Some errors such are missing fields, or wrong values, or conflicting
values were already caught logically when the high-level configuration
is transformed into the low-level configuration. Or later when
initializing handlers.

However, there was no mechanism to catch typos such as "httsCert"
instead of "httpsCert", or "leveldb" instead of "levelDB" in the
high-level configuration. Such errors would result in misconfiguration
(e.g. use of Let's Encrypt instead of the desired HTTPS certificate)
which can then even go unnoticed since the server still starts.

Therefore, this change generates a fake serverconfig.Config with all its
fields set, so that its JSON encoding results in a list of all the
possible configuration fields. This allows to compare the given
configuration fields with that list, and catch invalid names.

Change-Id: I4d6e61462353e52938db93ba332df2d52225e750
2017-09-06 18:19:14 +02:00
Mathieu Lonjaret 94a9d6a37c Merge "pkg/server: make DownloadHandler also handle directories when zipping" 2017-09-06 12:42:13 +00:00
mpl 5fef0785f2 pkg/server: make DownloadHandler also handle directories when zipping
The DownloadHandler only accepted file schemas as input for building a
zip archive so far.

It can now zip directories and their contents as well.

Non-regular files (socket, fifo, symlink) are now handled too.

As previously, no compression is applied when zipping.

When the DownloadHandler's Fetcher is a caching fetcher, all the files
that are supposed to be included in the archive are read, so we can
report reading errors even before starting to create the archive. We now
also take advantage of this optimization to build a
blobRef->filepath mapping when checking the files. Then, when the zip
archive is actually being built, the file path can be looked up in the
map, instead of having to assemble it again with recursive concatenation
of directory names.

Change-Id: I853c495798a9a43e12f3386603a70560ff46a237
2017-09-06 00:06:45 +02:00
mpl 1a830e5444 server/camlistored/ui: map aspect, add switch for clustering
controlled by the CAMLI_DEV_MAP_CLUSTERING env var

Change-Id: I7d790ca354e4c06b45833affb94337cb120ec7d3
2017-08-30 20:10:46 +02:00
mpl 109b101b33 pkg/types/camtypes: fix Expand isEmpty and tests
related to 93c6d682d2

Change-Id: Ib69cb6125113bafb530e5250b8cf3e20a7c2510f
2017-08-30 16:57:23 +02:00
mpl d717b58fd3 pkg/index: fix enumeration tests
related to 93c6d682d2

Change-Id: I2fa0df6da70df1297712ee0c9279a625b0ac88ca
2017-08-30 01:01:56 +02:00
mpl 8d4a554c3a pkg/search: fix bestByLocation test
related to 93c6d682d2

Change-Id: Ide7a120f501f4a140c039c0666b05f82efe510d2
2017-08-29 23:13:19 +02:00
mpl 088cdae82d server/camlistored/ui: map aspect improvements
-keep the browser URL bar in sync with the current search/zoom-level

-introduce the "map:" predicate, to be used as the current viewport in
the map aspect. This was previously achieved with the locrect predicate. We
try to keep this new predicate unknown to the server, and replaced on
the fly by an equivalent locrect predicate.

-stay on the map aspect when the search expression has a map predicate.
Same thing when loading a URL with a map predicate parameter: try to
load directly on map aspect, instead of going to search aspect first.

-make sure there's only at most one map query in flight at all times

Change-Id: Ibf928ee5c926670c221f212f14ca9799e1e7bb79
2017-08-29 18:13:07 +00:00
Brad Fitzpatrick b411c990f7 Merge "pkg/search: change corpus enumeration signatures for speed" 2017-08-29 18:12:58 +00:00
Brad Fitzpatrick 93c6d682d2 pkg/search: change corpus enumeration signatures for speed
Avoid select overhead in hot paths. Just use funcs.

Also, for sort-by-map searches, don't do a describe and pass over all
the results doing location lookups a second time. Remember the
location from the initial matching. Cache it on the search value.

Reduces some sort-by-map searches from 10 seconds to 3 seconds for
me. (still too slow, but good start)

Change-Id: I632954738df9accd802f28364ed11e48ddba0d14
2017-08-29 11:10:10 -07:00
Mathieu Lonjaret 5c9c433b5e Merge "pkg/index: ignore indexed NaN location" 2017-08-23 15:26:47 +00:00
mpl d72a8b3045 pkg/index: ignore indexed NaN location
We only started preventing NaNs from locations from being indexed at
ee13a3060b, so files indexed before
that could have introduced indexed NaNs, which we were not checking
against, until now.

Change-Id: I31fc8b9482cbd546591d553d7d8804700c7cf175
2017-08-23 17:19:28 +02:00
mpl 2d3b781103 pkg/search: add "ref:" predicate support
The "ref:prefix" search predicate is simply the equivalent of the

Constraint {
	BlobRefPrefix: prefix,
}

search constraint.

The "ref:prefix" search expression was already supported by the search
box of the web UI, but as opposed to (all, I think) other search
expressions, it was not supported server-side. Which means, it had to be
converted to a search Constraint as the above, before being sent in the
query.

This change therefore fixes this inconsistency. In addition, but
relatedly, since the map aspect relies on expressing the zoom-level as a
locrect expression, it is much simpler if the search query it uses only
has to be constructed from search expressions, and without search
constraints. So if we want to be able to support marking a single node
search with the map aspect, while dealing only with search expressions,
this change is necessary.

Fixes #939

Change-Id: Ia58f410198ecd1f7e0981321da370d687df3a120
2017-08-17 01:23:55 +02:00
Mathieu Lonjaret a7ec4646ca Merge changes I28c1184a,I0004c9ff
* changes:
  server/camlistored/ui: use marker cluster in map aspect
  server/camlistored/ui: on zooming/panning on map aspect, do new search
2017-08-16 22:56:59 +00:00
mpl 7832801040 server/camlistored/ui: on zooming/panning on map aspect, do new search
This change makes zooming and panning on the map aspect send a new
"MapSort" search query, so that the (1000, by default) most relevant
results for the currently displayed area always appear as markers
after a zoom/pan.

This required completely "lifting up" (in React lingo) the currentSearch
state out of the Header class, and into the Index class, which should
have already been done in a56372830a. This
is necessary because we need the expression in the search box to be mutable
both by the user('s input) and by the map aspect, which represents the
zoom level as a trailing "locrect" predicate in the search expression.

Fixes #938

Change-Id: I0004c9ff09f03b4f1d95a35e54605689eebf0c1a
2017-08-16 21:39:46 +02:00
mpl 7c02f7eb57 pkg/search: fix Around algo with unsorted source
The search for the Around blobRef was using the equality operator,
instead of an ordering operator, which was incorrect.

Also, if the Around blob.Ref had not been found during the search, we
were only returning early for special cases, which is incorrect. As soon
as we know that an Around blob is wanted, and we know it has not been
found, the search should abort.

Relatedly, a formal check to enforce that Around is incompatible with
MapSorted was added.

Finally, some tests to check the Around algorithm, in the case where we
don't use a sorted source, were added.

Change-Id: I94fc984cf4130badc879cdadaba718ef6361c9b7
2017-08-16 20:32:35 +02:00
mpl de6f7532f6 pkg/search: add Map sort
Since the map aspect was added to the web UI, it was discovered that it
currently does not scale well with the number of matching nodes.

The actual reason is that the search session is requesting an ever
increasing window of results, to get all results, instead of taking into
account the Continue token or Around mechanism.

However, this bug gives the opportunity to optimize the results for this
kind of interface. Instead of requesting the results in creation order,
until we get them all, we can request the set of nodes that looks the
best when displayed on the map. In other words, if there are more
results that the requested limit, the selected set of nodes should be
one that spreads around on the relevant area as evenly as possible.

This kind of selection is implemented in this CL, and will be used by
queries specifying the MapSort sort type.

Related: Issue #934

Change-Id: I6eb4901b40332863f17dab1ec4bfc11f3e99092a
2017-07-31 19:09:00 +02:00
Mathieu Lonjaret bd3514ace1 Merge "pkg/search: enable using Around with unsorted blob sources" 2017-07-31 14:56:40 +00:00
mpl f4d585bd9d pkg/search: enable using Around with unsorted blob sources
The Around Query field was only taken into account if the source of blobs
to search through was sorted (e.g. a slice of sorted permanodes from the
corpus).

However, since (when requested) we already do sort all the matching
blobs when they don't come from a sorted source, and we slice the
results to a range matching the requested limit, there is nothing
preventing from centering that final slice on the requested "around".

In addition to the intrinsic feature, this offers some sort of
continuation mechanism, which makes up for the fact that using a
continuation token is also only possible in some limited cases.

This will be useful in particular for file searches, with the
DirConstraint, where we want to be able to eventually get all the
results, but in several limited batches (e.g. from the search session of
the web UI).

Change-Id: Ic9c10cac9670b43b35994e3eff13221728611c70
2017-07-31 16:53:44 +02:00
mpl 1e56d64ee8 pkg/search: support location area predicate
This change adds the "locrect" search predicate, which works like the
"loc" predicate, except it allows to specify the coordinates of a
rectangular area as a location, instead of a named location.

The coordinates are the latitude and longitude of the North-East corner
of the rectangle, followed by the latitude and longitude of the
South-West corner. For example: locrect:48.63,-123.37,46.59,-121.28

Related: issue #934

Change-Id: I0cf39c1d0b49d557b2081f07b2c8b4508ccfc052
2017-07-20 01:34:27 +02:00
Mathieu Lonjaret 83a35501ed Merge "server/camlistored/ui: improve map aspect search and markers" 2017-07-05 23:06:03 +00:00
mpl e4b7db8274 server/camlistored/ui: improve map aspect search and markers
Notably:

-do not load any markers on an empty search query, because that would
mean loading absolutely all of the items with a location, which seems
like a bad idea.

-use different markers for different nodes. For now, foursquare
checkins, file images, and files have their own marker.

-vendor in https://github.com/lvoogdt/Leaflet.awesome-markers to achieve
the above, which relies on Font Awesome, which we already have in.
icons available for the markers: http://fontawesome.io/icons/

-when no location can be inferred from the search query, set the view to
encompass all markers that were drawn.

-when a location search is known, draw a rectangle representing the
results zone.

-use thumber for image in marker popup

-use title, if possible, instead of blobRef for link text in marker
popup

-switch to directly using OpenStreetMap tiles, instead of MapBox ones.

https://storage.googleapis.com/camlistore-screenshots/Screenshot_20170622-232359.png

Change-Id: Ibc84fa988aea8b8d3a2588ee8790adf6d9b5ad7a
2017-07-06 01:03:03 +02:00
mpl e60a1d4edd importer/gphotos: rm broken, and now useless, test
Because mediaURLsEqual was removed in
c848e5ecd8

Change-Id: I951d633103200863e43acddec825a09dcb81baf0
2017-06-23 16:53:04 +02:00
Mathieu Lonjaret 76becfba77 Merge "pkg/importer/gphotos: dedup with photos from picasa importer" 2017-06-23 14:32:52 +00:00
mpl c848e5ecd8 pkg/importer/gphotos: dedup with photos from picasa importer
The picasa importer and the gphotos importer fetch items in different
ways (one using the Picasa API, and the other the Google Drive API). But
most of the time a photo object downloaded from Picasa should result in
the same file as if downloaded from the Google Photos folder in Google
Drive (which is as it should be, really). Therefore the corresponding
file schemas in Camlistore should be identical as well. When that's the
case, there is no reason for the two importers to each create a
permanode if they're going to have the same camliContent. Especially
since it would look like duplicates (in the web UI in particular).

This change fixes the gphotos importer so that when it imports a photo,
and creates a file schema for it, it looks for an existing picasa
permanode having the same file schema as a camliContent. If one is found
it is reused, and the permanode ends up with an attributes set that is a
merge of the picasa-based attributes and the drive-based ones.

One caveat: the files in the Google Photos folder in Google Drive are
never updated with whatever modifications are done "at the source" (i.e.
on the items in Google Photos), they always stay as they were originally
uploaded.
(https://productforums.google.com/forum/#!msg/drive/HbNOd1o40CQ/VfIJCncyAAAJ).
As a result, such photos are different when imported from Picasa and
when imported from Drive, so they result in different files in
Camlistore.

In a subsequent CL, we'll modify the picasa importer in a similar manner
as what's done in this here CL.

Issues #874 #896

Change-Id: I6a3c89de1af404556f01ca61d92861933fd35158
2017-06-23 16:30:36 +02:00