1717 Commits

Author SHA1 Message Date
LeRoyce Pearson
2c59f95e87 Don't use iterate when opening manifest directory 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
1ffff1bb18 Add test case for fix in previous commit 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
0fa89dc51d Fix read from null pointer in CacheHash.hit
It occured when the manifest file was manually edited to include an extra
file. Now it will simply copy the file name in the manifest file
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
f13c67bcfe Return an index from CacheHash.addFile
This makes it possible for the user to retrieve the contents of the
file without running into data races.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
4d62d97076 Update code using deprecated ArrayList APIs 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
b429f4607c Make addFilePost* functions' documentation more clear 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
e7657f2938 Make CacheHash.release return an error
If a user doesn't care that the manifest failed to be written, they can
simply ignore it. The program will still work; that particular cache
item will simply not be cached.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
967b9825a7 Add "no file inputs" test
It checks whether the cache will respond correctly to inputs that don't
initially depend on filesystem state. In that case, we have to check
for the existence of a manifest file, instead of relying on reading the
list of entries to tell us if the cache is invalid.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
4254d389d3 Add test checking file changes invalidate cache 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
b67a9f2281 Switch to using testing.expect* in tests 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
d457919ff5 Make CacheHash cleanup consistent (always call release)
Instead of releasing the manifest file when an error occurs, it is
only released when when `CacheHash.release` is called. This maps better
to what a zig user expects when they do `defer cache_hash.release()`.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
05edfe983c Add addFilePost and addFilePostFetch functions 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
af730c64bd Put base64 alphabet into a named constant 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
d770dae1b8 Add documentation to CacheHash API 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
67d6432d10 Check for problematic timestamps 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
73d2747084 Open file with exclusive lock 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
204aa7dc1a Remove unnecessary contents field from File
It was causing a segfault on `mipsel` architecture, not sure why other
architectures weren't affected.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
c88ece3679 Remove error union from CacheHash.final 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
dfb53beb52 Check if inode matches inode from manifest 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
7917f25b0a Update cache_hash to zig master 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
16c5499098 Remove up files created in test at end of test 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
fffd59e6c4 Remove file handle from CacheHash
A file handle is not the same thing as an inode index number.
Eventually the inode will be checked as well, but there needs to be
a way to get the inode in `std` first.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
21d7430696 Replace ArrayList in write_manifest with an array 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
061c1fd9ab Use readAllAlloc
Now that the memory leak mentioned in #4656 has been fixed.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
4f709d224a Make hash digest same size as in the c API 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
8e4b80522f Return base64 digest instead of using an out variable 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
e75a6e5144 Rename cache_file -> addFile 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
50cbf1f3aa Add slice and array support to add method 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
fde188aadc Make type specific add functions
Basically, move type specific code into their own functions instead
of making `add` a giant function responsible for everything.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
4173dbdce9 Rename cache functions to add 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
27bf1f781b Store fs.Dir instead of path to dir 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
55a3925ab7 Rename CacheHashFile -> File 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
c8062321b3 Use fs.File 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
86fe88bbcb Use std.fs.base64_encoder in std.cache_hash 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
8c8813a5cf Add filesystem base64 decoder 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
ce5b2286f1 Support caching bools; make caching values infallible 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
de341b8fb8 Fix memory leak in cache_hash 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
8a77c1c637 Add cache method; add support for caching integers 2020-05-25 13:48:43 -04:00
LeRoyce Pearson
3158dc424e Partially implement cache hash API in zig 2020-05-25 13:48:43 -04:00
data-man
0ecdbdb3cb Support comptime floats in std.fmt 2020-05-25 12:48:59 -04:00
Alexandros Naskos
65d827183b Added custom build step id, made tests.zig steps use it 2020-05-25 11:36:12 +03:00
Alexandros Naskos
d268e0cf2e Added and id and a cast function to build steps 2020-05-25 11:20:31 +03:00
Andrew Kelley
3052fd84c8 fix regression in std.os.windows.fromSysTime 2020-05-25 00:37:47 -04:00
Andrew Kelley
53d011fa1a (breaking) std.time fixups and API changes
Remove the constants that assume a base unit in favor of explicit
x_per_y constants.

nanosecond calendar timestamps now use i128 for the type. This affects
fs.File.Stat, std.time.nanoTimestamp, and fs.File.updateTimes.

calendar timestamps are now signed, because the value can be less than
the epoch (the user can set their computer time to whatever they wish).

implement std.os.clock_gettime for Windows when clock id is
CLOCK_CALENDAR.
2020-05-24 21:40:08 -04:00
LeRoyce Pearson
c6e7d0fcfd Use better names for darwin timestart 2020-05-24 21:40:08 -04:00
LeRoyce Pearson
b85a191398 Fix compile errors for MacOS 2020-05-24 21:40:08 -04:00
LeRoyce Pearson
2dfe798217 Use once to init _timestart in thread safe way 2020-05-24 21:40:08 -04:00
LeRoyce Pearson
7586ce0023 Implement a faster way to get nanoseconds on darwin 2020-05-24 21:40:08 -04:00
LeRoyce Pearson
bb46894115 Add std.time.nanoTimestamp function 2020-05-24 21:40:08 -04:00
Jethro Nederhof
4b1a846471
target: Implement running OS version detection for FreeBSD (#5416)
* target: Implement OS version detection for FreeBSD

Fixes #4582

* freebsd version: handle errors explicitly
2020-05-24 20:52:13 -04:00