Commit Graph

52 Commits

Author SHA1 Message Date
Brad Fitzpatrick 7e486bd9a7 all: address misc staticcheck warnings
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2024-01-14 17:02:10 -08:00
Brad Fitzpatrick bc9fbcd89e chip away at some staticcheck warnings
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2024-01-13 15:57:55 -08:00
Oleksandr Redko 001c417e73
all: replace deprecated io/ioutil with io and os (#1647) 2023-01-23 10:25:14 -08:00
Michael Hoffmann f06efdb51f misc: remove sha1 from tests, remove testhooks, minor cleanups 2023-01-13 07:58:19 -08:00
Brad Fitzpatrick 6614d23428 schema: simplify parseSuperset
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2023-01-13 07:48:53 -08:00
luz paz d605f86c82 Fix various typos
Found via `codespell -q 3 -S ./clients/web/embed,./clients/chrome -L ba,everytime,impres,keypair,msdos,pres,ro,te,ue`
2022-05-02 14:31:09 -07:00
Eng Zer Jun 2977046a4c all: use `T.TempDir` to create temporary directory
The directory created by `T.TempDir()` and is automatically removed when
the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-03-04 08:18:24 -08:00
Michael Hoffmann 5b6e59539d cleanup: remove pkg/test/asserts
This PR removes the deprecated pk/test/asserts.
2022-03-04 08:17:07 -08:00
Alexandre Viau fb961cf310
make codebase go-vet-clean (#1379)
Co-authored-by: Bob Glickstein <bobg@emphatic.com>
2021-07-26 21:19:53 -04:00
aviau 231ba4233f pkg/schema: create CamliType type
Create a CamliType type in pkg/schema and use it in a couple of
packages.

It can be implemented in other packages as we go.
2021-01-19 00:47:58 -05:00
Brad Fitzpatrick e25375ca22 schema: skip symlink tests on Windows
Change-Id: I7b076d886883ac0ed19df0cc5d3797cfc04b1c75
2018-05-01 14:17:35 -07:00
mpl db2604f981 pkg/schema: break static-sets in subsets for large directories
The current maximum size for a schema blob is 1MB. For a large enough
directory (~20000 children), the resulting static-set JSON schema is
over that maximum size.

We could increase that maximum, but we would eventually hit the maximum
blob size (16MB), which would only allow for ~300000 children. Even if
that is an uncommon size, it is technically possible to have such large
directories, so I don't think it would be reasonable to restrict users
to such a limit. So it does not seems like enough of a solution.

The solution proposed in this CL is to spread the children of a
directory (when they are more numerous than a given maximum, here set to
10000) onto several static-sets, recursively if needed. These
static-sets (subsets of the whole lot of children) are stored in the new
"mergeSets" field of their parent static-set schema. The actual fileRefs
or dirRefs, are still stored in the "members" field of the subset they were
spread in. The "mergeSets" and "members" field of a static-set are therefore
mutually exclusive.

Fixes #924

Change-Id: Ibe47b50795d5288fe904d3cce0cc7f780d313408
2018-02-09 01:36:38 +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
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 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
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 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
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
Aaron Boodman 51ef6152fd Add -search argument to camput share.
Bug: https://code.google.com/p/camlistore/issues/detail?id=512

Change-Id: Ic0dd559c98589107fcdeade8784699cf6b2f1761
2014-09-06 18:50:21 -07:00
Brad Fitzpatrick c2dd9a1fce schema: add test of time.ParseInLocation with UnknownLocation
Change-Id: I23c1007b53d794e36e9eeaad03e9d11a4cd3c397
2014-07-24 13:44:31 -07:00
Brad Fitzpatrick ab885a369c schema: add UnknownLocation and IsZoneKnown
Change-Id: Ia056d03a367502ea4d06e5748cc7de7072c3e12c
2014-07-24 13:35:18 -07:00
Brad Fitzpatrick 077763fcbb schema: use GPS location to find timezone from EXIF when UTC offset is unknown
Change-Id: Ia3590424db36508b491d8f19829738fe102e5c3d
2014-07-13 10:26:54 -07:00
Brad Fitzpatrick af4df6f8c5 schema: rewrite symlink test to not delete testdata, not use asserts
Change-Id: I238ee5d55203f5c53b294d82e2cc626c4ef78ef2
2014-07-13 10:02:30 -07:00
tnt 5d8eeb534b Fixed wrong calls to formatting functions.
E.g: fmt.Println("%s", "hello world") -> fmt.Printf("%s", "hello world")

Change-Id: I51c0bd54c14173e074fafd86c83a5287fcdb1520
2014-06-30 22:05:22 +02:00
Brad Fitzpatrick 26bdefc4b0 osutil: remove err error stutter, add osutil.ErrNotSupported
Change-Id: I483f30d3d4db39a9ffa0f83c1e055d7a59edba4b
2014-05-31 10:42:44 +09:00
Brian Gitonga Marete 53ab352fa7 pkg/schema, cmd/camget, cmd/camput: Support sockets.
This patch:

1. Introduces a JSON schema for unix domain sockets (socket files).
2. Adds support for the new schema to pkg/schema.
3. Adds support for uploading and restoring sockets to camput and
camget respectively.

Depends on CL 2706 (https://camlistore-review.googlesource.com/2706/)

Change-Id: Ib0d6e9f9ebd348f55efee5a08cd774f3969d0760
2014-05-21 18:51:14 +03:00
Brian Gitonga Marete e9dd1af195 cmd/camget, cmd/camput, pkg/schema: Support FIFOs.
This patch:

1. Introduces a JSON schema for FIFOs (named pipes).
2. Adds support for uploading and restoring FIFOs to camput and camget
respectively.

It includes tests for the basic schema support in pkg/schema and
integration tests for camput and camget.

This CL does not add FIFO support to the HTTP server and fs (cammount
support) code. Those will be addressed in a subsequent patch.

Change-Id: Iab926073c36e653d25e693a559178bea9bf19b9a
2014-05-21 14:52:23 +03:00
Brad Fitzpatrick bf9909028f schema: improved mixedArrayFromString
Change-Id: Iff9d68a498e13e5a90cd68c07ee9986c3407a8cc
2014-05-14 16:07:22 -07:00
Edward Sheffler III 04a38a2515 schema: unexport NewClaim
Change-Id: If088d7b8dd521f89093376282b84a64c59c7b778
2014-04-18 13:25:01 -07:00
Brian Gitonga Marete 0c4b67d3bf cmd/camget: Support restoring symbolic links when writing to filesystem.
This patch adds support for restoring symbolic links when camget is
called with the -o option.

This fixes an issue which caused `camget -o' to write an incomplete
snapshot to the target directory when it encountered a symlink.

Note that no attempt is made to restore the symlink metadata since: a)
A symlink's permissions do not matter and are fixed to 1777 on some
systems b) Go's os.Chtimes() always acts on the symlink target c)
os.Chown() is not currently called for any file in the current code.

Tested on Linux.

Change-Id: I7099592dcd5cc513c2685671be6f6b165f8f8053
2014-03-08 05:14:59 +03:00
Brad Fitzpatrick c6b78818b8 schema: better test for issue 305
Change-Id: I791d2cd614f8cdc5921a05a0c91589f8965ed06f
2013-12-30 20:17:30 -08:00
Brad Fitzpatrick 339b8c8af4 schema: fix blob.Builder JSON clone bug; issue 305
Change-Id: I8ef981f96abdac1a7e2c101e1c9c3cde52fb6f5f
2013-12-30 19:40:58 -08:00
Brad Fitzpatrick a06555872c schema: a new tests that doesn't test anything yet
Change-Id: I30c79f10fa68d3441c6e937344927d0b996dcf70
2013-12-30 11:53:55 -08:00
mpl d4b5e413a2 schema: add delete claim
Also rename other claim types for consistent style.

http://camlistore.org/issue/191

Change-Id: I1dc1283bd961481ad793b92262cf5ce641d9fdc8
2013-11-03 00:37:49 +01:00
mpl 304f5c4b38 camput attr: support -del
Change-Id: I28460fed5b572ba9a83cfcb04f38e42124fa723f
2013-10-03 15:07:43 +02:00
mpl ba8f88c21a devcam test, replaces make presubmit
http://camlistore.org/issue/223

Change-Id: Iaaea9926a98d7d3335fd6ee52daa225e51ec4703
2013-09-19 17:00:59 +02:00
Brad Fitzpatrick abd2393c06 share: fix shares with no expiration time.
with tests.

Change-Id: I5861104c223de8b4381a69e0ab16998979ca9106
2013-09-08 18:04:54 -07:00
Brad Fitzpatrick 2cf4d68267 Let shares have expiration times.
Change-Id: Iecae106302ba43c354b6987163830cf78a70d12c
2013-09-08 17:46:40 -07:00
Bill Thiede 76338e4d29 schema: fix bug in AsShare, add tests.
Bug in AsShare() falsely returns '{{nil}}, true' for non-share claims.

Change-Id: Ib0443082fb9ca9feaf2015771967ff4bc40ac4b9
2013-08-31 12:11:43 -07:00
Brad Fitzpatrick 0bdf20884b all: delete pkg/blobref; convert all from *blobref.BlobRef to new blob.Ref
Change-Id: Id2dfb7f19452bedf4f3c9310b36227fd8117b225
2013-08-03 19:54:30 -07:00
mpl febbaf1387 schema: share is a claim with claimType="share"
http://camlistore.org/issue/150

Change-Id: I1dcd1709c886839df507b02beee2e19986783693
2013-06-22 00:48:51 +02:00
mpl a55595ba8e schema: populate claim with permanode too
Change-Id: Ide340baa9ffa6a9cfd2994c2e4fc41383af01a03
2013-02-26 19:21:19 +01:00
Brad Fitzpatrick 3602a03188 schema: add support for multi-claims.
No indexing support yet.

Part of http://camlistore.org/issue/110

Change-Id: Ibeb04ef24e24857a462eeefc7857fda4bbb5dbed
2013-02-25 20:56:20 -08:00
Brad Fitzpatrick cfc32e4a05 schema, camget: more work on deleting the Superset type.
not much more remains.

Change-Id: I6cfe4145f67b100a0e2509f88ce6e1c580b7f9fe
2013-01-22 09:32:40 -08:00
Brad Fitzpatrick dd72cd4434 schema: verify no slashes in fileName in FileNameString accessor.
Change-Id: I1b02e67144fed1f80123530786af55c74bd64f36
2013-01-13 20:43:55 -08:00
Brad Fitzpatrick 11eac8721e Convert more code to use schema.Map instead of map[string]interface{}
Change-Id: I285fd1b0e730ebd32069688a71cb992c43770ade
2012-08-22 03:47:38 +10:00
Brad Fitzpatrick b815a2b758 camput: add -filenodes option for per-file content-based planned permanodes
Change-Id: Ic03b990654d860e03b4cc710de92f7d40c392df8
2012-08-21 16:11:10 +10:00
Brad Fitzpatrick 6fec55a384 simplify legacy time code
Change-Id: I643b722adddaa3bfecab6044de2c5a373e5d7dd1
2012-05-13 13:27:11 -07:00
Brad Fitzpatrick ad6047abf0 initialism
Change-Id: I3ae54133a56b48f614938ac3082dd28ae6197980
2012-05-13 13:06:50 -07:00
Brad Fitzpatrick 18e53cd72f rename MapToCamliJson to Go style initialism MapToCamliJSON
Change-Id: I674944c9fafa6b78c495d22c525b9ffd0b75dbf9
2012-04-15 07:45:10 -07:00