Skip to content

Commit

Permalink
Update custom_cache.rst (conan-io#1165)
Browse files Browse the repository at this point in the history
* Update custom_cache.rst

Fix grammar. Capitalize proper noun "Conan". Add missing comma. Modify some phrasing.

* Update custom_cache.rst

Fix as per comment.
  • Loading branch information
dslotter authored and memsharded committed Mar 29, 2019
1 parent af5c8a4 commit 8175e0c
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions mastering/custom_cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
Conan local cache: concurrency, Continuous Integration, isolation
=================================================================

Conan needs access to some, per user, configuration files, as the **conan.conf** file that
Conan needs access to some per user configuration files, such as the **conan.conf** file that
defines the basic client app configuration. By convention, this file will be located in the
user home folder **~/.conan/**. This folder will typically also store the package cache, in
**~/.conan/data**. Though the latter is configurable in *conan.conf*, conan needs
user home folder **~/.conan/**. This folder will also typically store the package cache in
**~/.conan/data**. Even though the latter is configurable in *conan.conf*, Conan needs
some place to look for this initial configuration file.

There are some scenarios in which you might want to use different initial locations for the
conan client application:
Conan client application:

- Continuous Integration (CI) environments, in which multiple jobs can also work concurrently.
Moreover, these environments would typically want to run with different user credentials, different
Expand All @@ -23,8 +23,8 @@ conan client application:

Using different caches is very simple. You can just define the environment variable **CONAN_USER_HOME**.
By setting this variable to different paths, you have multiple conan caches,
something like python "virtualenvs". Just changing the value of **CONAN_USER_HOME** you can
switch among isolated conan instances that will have independent package storage caches, but also
something like python "virtualenvs". Just changing the value of **CONAN_USER_HOME**, you can
switch among isolated Conan instances that will have independent package storage caches, and also
different user credentials, different user default settings, and different remotes configuration.

.. note::
Expand All @@ -48,9 +48,8 @@ Linux/macOS users:
You can now:

- Build concurrent jobs, parallel builds in Continuous Integration or locally, just setting the variable before launching conan commands.
- You can test locally different user credentials, default configurations, different remotes, just by switching from one cache to the
others.
- Build concurrent jobs, parallel builds in Continuous Integration or locally, by just setting the variable before launching Conan commands.
- You can test locally different user credentials, default configurations, or different remotes, just by switching from one cache to another.

.. code-block:: bash
Expand All @@ -71,15 +70,15 @@ Concurrency

Conan local cache support some degree of concurrency, allowing simultaneous creation or installation of different packages, or building
different binaries for the same package. However, concurrent operations like removal of packages while creating them will fail. If you need
different environments that operate totally independently, you probably want to use different conan caches for that.
different environments that operate totally independently, you probably want to use different Conan caches for that.

The concurrency is implemented with a Readers-Writers lock mechanism, which in turn uses ``fasteners`` library file locks to achieve
multi-platform portability. As this "mutex" resource is by definition not enough to implement a Readers-Writers solution, some active-wait
with time sleeps in a loop is necessary. However, this time sleeps will be rare, only sleeping when there is actually a collision and
waiting on a lock.

The lock files will be stored inside each ``Pkg/version/user/channel`` folder in the local cache, in a ``rw`` file for locking the entire
package, or in a set of locks (one per each different binary package, under a subfolder called ``locks``, each lock named with the binary
package, or in a set of locks (one per each different binary package, under a subfolder called ``locks``, with each lock named with the binary
ID of the package).

It is possible to disable the locking mechanism in ``conan.conf``:
Expand Down

0 comments on commit 8175e0c

Please sign in to comment.