Documentation

Lake.Config.Cache

Cache Map #

@[reducible, inline]

Maps an input hash to a structure of output artifact content hashes.

These mappings are stored in a per-package JSON Lines file in the Lake cache.

Equations
    Instances For

      The current version of the input-to-output mappings file format.

      Equations
        Instances For
          def Lake.CacheMap.parse (inputName contents : String) :

          Parse a Cache from a JSON Lines string.

          Equations
            Instances For

              Loads a CacheMap from a JSON Lines file. Errors if the file is ill-formatted or the read fails for other reasons.

              Equations
                Instances For
                  Equations
                    Instances For

                      Save a CacheMap to a JSON Lines file. Entries already in the file but not in the map will not be removed.

                      Equations
                        Instances For

                          Write a CacheMap to a JSON Lines file.

                          Equations
                            Instances For
                              def Lake.CacheMap.get? (inputHash : Hash) (cache : CacheMap) :

                              Returns the output data associated with the input hash in the cache.

                              Equations
                                Instances For
                                  def Lake.CacheMap.insertCore (inputHash : Hash) (val : Lean.Json) (cache : CacheMap) :

                                  Associate output data (as JSON) with the given the input hash.

                                  Equations
                                    Instances For
                                      @[inline]
                                      def Lake.CacheMap.insert {α : Type u_1} [Lean.ToJson α] (inputHash : Hash) (val : α) (cache : CacheMap) :

                                      Associate output data with the given the input hash.

                                      Equations
                                        Instances For

                                          Extract each output from their structured data into a flat array of artifact descriptions.

                                          Equations
                                            Instances For

                                              Cache Ref #

                                              @[reducible, inline]

                                              A mutable reference to a CacheMap.

                                              Equations
                                                Instances For
                                                  @[inline]
                                                  Equations
                                                    Instances For
                                                      @[inline]
                                                      def Lake.CacheRef.get? (inputHash : Hash) (cache : CacheRef) :

                                                      Returns the output data associated with the input hash in the cache.

                                                      Equations
                                                        Instances For
                                                          @[inline]
                                                          def Lake.CacheRef.insert {α : Type u_1} [Lean.ToJson α] (inputHash : Hash) (val : α) (cache : CacheRef) :

                                                          Associate output data with the given the input hash.

                                                          Equations
                                                            Instances For

                                                              Local Cache #

                                                              structure Lake.Cache :

                                                              The Lake cache directory.

                                                              Instances For
                                                                Equations
                                                                  Instances For
                                                                    @[inline]

                                                                    Returns the artifact directory for the Lake cache.

                                                                    Equations
                                                                      Instances For
                                                                        @[inline]
                                                                        def Lake.Cache.artifactPath (cache : Cache) (contentHash : Hash) (ext : String := "art") :

                                                                        Returns the path to artifact in the Lake cache with extension ext.

                                                                        Equations
                                                                          Instances For

                                                                            Returns the artifact in the Lake cache corresponding the given artifact description.

                                                                            Equations
                                                                              Instances For

                                                                                Returns the artifact in the Lake cache corresponding the given artifact description. Errors if missing.

                                                                                Equations
                                                                                  Instances For

                                                                                    Returns path to the artifact for each output. Errors if any are missing.

                                                                                    Equations
                                                                                      Instances For
                                                                                        @[inline]

                                                                                        The directory where input-to-output mappings are stored in the Lake cache.

                                                                                        Equations
                                                                                          Instances For
                                                                                            @[inline]
                                                                                            def Lake.Cache.outputsFile (cache : Cache) (scope : String) (inputHash : Hash) :

                                                                                            The file containing the outputs of the given input for the package.

                                                                                            Equations
                                                                                              Instances For
                                                                                                def Lake.Cache.writeOutputsCore (cache : Cache) (scope : String) (inputHash : Hash) (outputs : Lean.Json) :

                                                                                                Cache the outputs corresponding to the given input for the package.

                                                                                                Equations
                                                                                                  Instances For
                                                                                                    @[inline]
                                                                                                    def Lake.Cache.writeOutputs {α : Type u_1} [Lean.ToJson α] (cache : Cache) (scope : String) (inputHash : Hash) (outputs : α) :

                                                                                                    Cache the outputs corresponding to the given input for the package.

                                                                                                    Equations
                                                                                                      Instances For
                                                                                                        def Lake.Cache.writeMap (cache : Cache) (scope : String) (map : CacheMap) :

                                                                                                        Cache the input-to-outputs mappings from a CacheMap.

                                                                                                        Equations
                                                                                                          Instances For
                                                                                                            def Lake.Cache.readOutputs? (cache : Cache) (scope : String) (inputHash : Hash) :

                                                                                                            Retrieve the cached outputs corresponding to the given input for the package (if any).

                                                                                                            Equations
                                                                                                              Instances For
                                                                                                                @[inline]

                                                                                                                The directory where input-to-output mappings of downloaded package revisions are cached.

                                                                                                                Equations
                                                                                                                  Instances For
                                                                                                                    @[inline]

                                                                                                                    Returns path to the input-to-output mappings of a downloaded package revision.

                                                                                                                    Equations
                                                                                                                      Instances For

                                                                                                                        Remote Cache Service #

                                                                                                                        Configuration of a remote cache service (e.g., Reservoir or an S3 bucket).

                                                                                                                        A given configuration is not required to support all cache service functions, and no validation of the configuration is performed by its operations. Users should construct a service that supports the desired functions by using CacheService's smart constructors (e.g., reservoir, uploadService).

                                                                                                                        • key : String
                                                                                                                        • artifactEndpoint : String
                                                                                                                        • revisionEndpoint : String
                                                                                                                        • isReservoir : Bool

                                                                                                                          Is this a Reservoir cache service configuration?

                                                                                                                        • apiEndpoint : String
                                                                                                                        • repoScope : Bool
                                                                                                                        Instances For

                                                                                                                          Constructors #

                                                                                                                          @[inline]
                                                                                                                          def Lake.CacheService.reservoirService (apiEndpoint : String) (repoScope : Bool := false) :

                                                                                                                          Constructs a CacheService for a Reservoir endpoint.

                                                                                                                          Equations
                                                                                                                            Instances For
                                                                                                                              @[inline]
                                                                                                                              def Lake.CacheService.uploadService (key artifactEndpoint revisionEndpoint : String) :

                                                                                                                              Constructs a CacheService to upload artifacts and/or outputs to an S3 endpoint.

                                                                                                                              Equations
                                                                                                                                Instances For
                                                                                                                                  @[inline]
                                                                                                                                  def Lake.CacheService.downloadService (artifactEndpoint revisionEndpoint : String) :

                                                                                                                                  Constructs a CacheService to download artifacts and/or outputs from to an S3 endpoint.

                                                                                                                                  Equations
                                                                                                                                    Instances For
                                                                                                                                      @[inline]

                                                                                                                                      Constructs a CacheService to download just artifacts from to an S3 endpoint.

                                                                                                                                      Equations
                                                                                                                                        Instances For
                                                                                                                                          @[inline]

                                                                                                                                          Reconfigures the cache service to interpret scopes as repositories (or not if false).

                                                                                                                                          For custom endpoints, if true, Lake will augment the provided scope with toolchain and platform information in a manner similar to Reservoir.

                                                                                                                                          Equations
                                                                                                                                            Instances For

                                                                                                                                              Artifact Transfer #

                                                                                                                                              The MIME type of Lake/Reservoir artifact.

                                                                                                                                              Equations
                                                                                                                                                Instances For
                                                                                                                                                  def Lake.CacheService.artifactUrl (contentHash : Hash) (service : CacheService) (scope : String) :
                                                                                                                                                  Equations
                                                                                                                                                    Instances For
                                                                                                                                                      def Lake.CacheService.downloadArtifact (descr : ArtifactDescr) (cache : Cache) (service : CacheService) (scope : String) (force : Bool := false) :
                                                                                                                                                      Equations
                                                                                                                                                        Instances For
                                                                                                                                                          def Lake.CacheService.downloadArtifacts (descrs : Array ArtifactDescr) (cache : Cache) (service : CacheService) (scope : String) (force : Bool := false) :
                                                                                                                                                          Equations
                                                                                                                                                            Instances For
                                                                                                                                                              def Lake.CacheService.downloadOutputArtifacts (map : CacheMap) (cache : Cache) (service : CacheService) (localScope remoteScope : String) (force : Bool := false) :
                                                                                                                                                              Equations
                                                                                                                                                                Instances For
                                                                                                                                                                  def Lake.CacheService.uploadArtifact (contentHash : Hash) (art : System.FilePath) (service : CacheService) (scope : String) :
                                                                                                                                                                  Equations
                                                                                                                                                                    Instances For
                                                                                                                                                                      Equations
                                                                                                                                                                        Instances For

                                                                                                                                                                          Output Transfer #

                                                                                                                                                                          The MIME type of Lake/Reservoir input-to-output mappings for a Git revision.

                                                                                                                                                                          Equations
                                                                                                                                                                            Instances For
                                                                                                                                                                              def Lake.CacheService.revisionUrl (rev : String) (service : CacheService) (scope : String) (platform toolchain : String := "") :
                                                                                                                                                                              Equations
                                                                                                                                                                                Instances For
                                                                                                                                                                                  def Lake.CacheService.downloadRevisionOutputs? (rev : String) (cache : Cache) (service : CacheService) (localScope remoteScope : String) (platform toolchain : String := "") (force : Bool := false) :
                                                                                                                                                                                  Equations
                                                                                                                                                                                    Instances For
                                                                                                                                                                                      def Lake.CacheService.uploadRevisionOutputs (rev : String) (outputs : System.FilePath) (service : CacheService) (scope : String) (platform toolchain : String := "") :
                                                                                                                                                                                      Equations
                                                                                                                                                                                        Instances For