The method of determining if a repository exists doesn't work on Windows, since
the "url.Scheme" will contain the drive letter - "c" in "c:\backup",
so as a first step we check if the URL can be opened as a file,
and if so, we assume it is a 'local' type repository.
Files must be closed on Windows before they can be deleted.
Therefore we keep track of all open files, and closes them before
we delete them.
Also we don't set finished blobs to read-only on Windows, since
that prevents us from deleting them.
Since Windows cannot to a SIGHUP test to check if a process is live,
the test will fail because the lock isn't detected as stale if a process with
that ID exists. Process IDs are re-used agressively on Windows, so add 500000 makes
the test extremely unlikely (if not impossible) to fail.
On Windows, User ID/Group ID is not a number, so we ignore any parsing error
that may come from attempting to convert it to an integer. It will simply be '0'.
Don't defer the process Release until we have checked the error.
Skip the SIGHUP connection attempt on Windows. If the process exists, we assume it is running.
This changes `repository.LoadBlob()` so that a destination buffer must
be provided, which enables the fuse code to use a buffer from a
`sync.Pool`. In addition, release the buffers when the file is closed.
At the moment, the max memory usage is defined by the max file size that
is read in one go (e.g. with `cat`). It could be further optimized by
implementing a LRU caching scheme.
Since backend.ID is always a slice of constant length, use an array
instead of a slice. Mostly, arrays behave as slices, except that an
array cannot be nil, so use `*backend.ID` insteaf of `backend.ID` in
places where the absence of an ID is possible (e.g. for the Subtree of a
Node, which may not present when the node is a file node).
This change allows to directly use backend.ID as the the key for a map,
so that arbitrary data structures (e.g. a Set implemented as a
map[backend.ID]struct{}) can easily be formed.
This adds the exclude patterns used to create a backup in the snapshot,
so we can later compute statistics (like git does) on the data
structure, e.g. added/removed files etc. For that, we need the exclude
pattern.