← all modules

Std.Ai.Store

Std.Ai.Store
  Std.Ai.Store — where the model registry keeps its artefacts: a local

Types
  type Store
  type alias Config = { kind : String , root : String , bucket : String , prefix : String , region : String , endpoint : String , token : Maybe Secret , awsKeys : Maybe AwsKeys }
  type alias AwsKeys = { accessKey : String , secretKey : Secret , sessionToken : Maybe Secret }
  type alias Blob = { sha256 : String , size : Int }
  type alias Setting = { key : String , name : String , value : String , source : String }
  type alias HttpCall = { method : String , url : String , headers : List ( String, String ) , timeoutMs : Int }
  type alias Object = { body : String , generation : String }
  type alias SigV4 = { method : String , host : String , path : String , query : String , headers : List ( String, String ) , payloadHash : String , region : String , service : String , amzDate : String , accessKey : String , secretKey : Secret }
  type alias Signature = { authorization : String , signedHeaders : String , signature : String }

Values
  bucketLocation : Store -> Task Error String
      Where the store's data lives: a GCS bucket's location in lower case
  configured : String -> Task Error Store
      The store at the location in code, unless the operator set
  deletePrefix : Store -> String -> Task Error Int
      Delete every object below a prefix and return how many there were. An
  fetch : Store -> String -> Task Error String
      A local path holding the blob with this digest, checked against the
  fetchAt : Store -> String -> String -> Task Error String
      A local path holding a named object's bytes, checked against `sha256`
  fromUrl : String -> Result Error Store
      A store from its location: `file://<dir>`, `gs://<bucket>/<prefix>` or
  gcs : String -> String -> Store
      A store in a GCS bucket, below a prefix (`""` for the bucket's root).
  getAt : Store -> String -> Task Error (Maybe String)
      A named object's text, `Nothing` when it does not exist.
  getObject : Store -> String -> Task Error (Maybe Object)
      A named object's text and generation, `Nothing` when it does not exist.
  list : Store -> String -> String -> Task Error (List String)
      The keys below a prefix that sort after `startOffset` (`""` for all), in
  local : String -> Store
      A store in a local directory (created on first use).
  location : Store -> String
      The store's location, as `fromUrl` reads it. It holds no credential.
  put : Store -> String -> Task Error Blob
      Store the file at a path and return its digest and size. Storing bytes
  putAt : Store -> String -> String -> Task Error ()
      Write a named object, replacing what is there.
  putIf : Store -> String -> String -> String -> Task Error Bool
      Write a named object only if its generation is still `generation`: `""`
  s3 : String -> String -> String -> Store
      A store in an S3 bucket, below a prefix. The region is the bucket's
  signV4 : SigV4 -> Signature
      Sign a request with AWS Signature Version 4. Pure: the same request,
  withAwsKeys : String -> Secret -> Store -> Store
      S3 keys to use instead of the platform's credentials: the access key id
  withEndpoint : String -> Store -> Store
      Send the store's requests to another server: an emulator, MinIO or
  withToken : Secret -> Store -> Store
      A GCS access token to use instead of the platform's credentials.