machinelearninghttp

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package machinelearninghttp implements the FrogML SDK's Artifactory model transaction and manifest API on local and one-node federated repositories. The routes sit on Artifactory's /artifactory/api/machinelearning/{repo} prefix; the layout and the publication rules are the format package's (artifacts/ecosystem/machinelearning), and this package answers HTTP with them.

Role

artifacts module, ecosystem layer: the native FrogML model transaction and manifest protocol of the Machine Learning slice. It is named machinelearninghttp so that it does not shadow net/http. Outside tests, only its own http subtree, the module's http adapters and app may import it (decision 0044, dependency rule 9).

Inputs

  • Driving: the server, which mounts Protocol through the router kit (pkgroute) for repositories of package type machinelearning.
  • Driven: the router kit (pkgroute.Kit), which resolves the repository and the caller, checks permissions, stages content and stores items through the item service, where the format's hooks admit them, reads items, properties and blobs, runs a commit in one metadata transaction and writes errors; the request's base URL (platform/httpkit/baseurl), onto which download URLs point; the caller's principal (the kernel), who owns a transaction; and the format package, which checks identities, decodes, reads and verifies manifests, rechecks a transaction's owner and expiry and rebuilds the index.
  • Settings: none.

Outputs

  • Protocol: the routes and the Artifactory error profile.
  • Answers: a started transaction's ID and its files, lead, dependencies and code upload paths (POST model/{name}/start-transaction[/{version}], 200); a committed version's ID and version (PUT model/entity-manifest/{name}/{version}/{transaction}, 201); and a published manifest with a download URL for every file (GET model/entity-manifest/{name}/{version}, 200, not cached). Each route also takes a {namespace}/{name} model.

Invariants

  • Identities follow the format package's rules after one unescape, and a request with a query is refused (400). A start without a version gets the current Unix millisecond time as its version.
  • Starting needs an authenticated caller (401) with the write grant on the version's folder, and a version not yet published (409). The transaction ID is the current Unix millisecond time, tried up to 32 times while it collides with a stored transaction (409 after that).
  • A commit is multipart form data (415) of at most the manifest limit plus 64 KiB, with one modelManifest field and at most one additionalData field of at most 64 KiB, 256 properties, 255-byte keys and 4,096-byte values (400). The manifest must name the route's model and version (400), and its download URLs are dropped before it is stored.
  • A commit publishes in one metadata transaction or not at all: it rechecks the transaction's owner (403) and expiry (409), the write grant on every declared file and on the manifest (403), and every staged file's size and SHA-256 (409), then stores the files, the manifest with its properties and the index. Repeating the same manifest and properties succeeds; anything else for a published version conflicts (409).
  • The manifest GET needs the read grant on the manifest and on every declared file (403), and answers only a complete version (404 for a missing file, 409 for one that differs). After the manifest's read grant and before the manifest is read, Artifactory's download policy checks the manifest's own path, models/<name>/<version>/ model-manifest.json: a blacked-out repository, or include and exclude patterns rejecting that path, answer 404 with the item routes' message. Patterns rejecting a declared file leave the manifest answered, with the file listed.
  • Statuses and error texts stay byte-identical.

References

Status

Implemented P9c, which delivered the plan's P32 group (issues #777 to #780 and #789). Moved here in P9d.

Testing

  • protocol_test.go (external, machinelearninghttp_test, building the router through the server test harness): the publication lifecycle and transaction validation.
  • fault_test.go (external, building the router through the server test harness): a commit rolled back on storage failure, and start and replay storage failures.
  • authority_test.go (external): model file permissions and transaction ownership, a commit that rechecks every destination, and model identity with immutable commits.
  • privacy_test.go (external): private model records that cannot escape, and concurrent commits that publish one version.
  • parse_test.go (in-package): commit parsing, and identities with invalid escapes refused.

The @machinelearning acceptance scenarios publish and download through the pinned FrogML SDK on local and federated repositories, and refuse invalid credentials.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Protocol

func Protocol() pkgroute.Protocol

Protocol returns the FrogML model protocol for machinelearning repositories, with the Artifactory error profile. For a model named {name} or {namespace}/{name}, POST model/.../start-transaction, with or without a version, starts an upload transaction; PUT model/entity-manifest/.../{version}/{transaction} commits its manifest; and GET model/entity-manifest/.../{version} reads a published manifest. It sets no sources, so local and federated repositories serve their own items and any other class, which configuration refuses for this type, answers 501.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL