forkd 0.3.1__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: forkd
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Open-source fork-on-write microVM sandbox primitive (E2B-compatible surface)
5
5
  Author-email: Deeplethe <info@deeplethe.com>
6
6
  License: Apache-2.0
@@ -14,5 +14,5 @@ Most agent runtimes use both: ``Controller`` to spawn / branch / kill,
14
14
  from .controller import Controller, ControllerError
15
15
  from .sandbox import CommandResult, Sandbox
16
16
 
17
- __version__ = "0.3.1"
17
+ __version__ = "0.3.2"
18
18
  __all__ = ["Sandbox", "CommandResult", "Controller", "ControllerError"]
@@ -104,9 +104,20 @@ class Controller:
104
104
  n: int = 1,
105
105
  per_child_netns: bool = False,
106
106
  memory_limit_mib: Optional[int] = None,
107
+ prewarm: bool = False,
107
108
  ) -> list[dict]:
108
109
  """``POST /v1/sandboxes`` — fork N children from a snapshot tag.
109
110
 
111
+ Parameters
112
+ ----------
113
+ prewarm:
114
+ When true, each child performs a throwaway snapshot to
115
+ scratch storage immediately after restore to fault-in all
116
+ guest pages. Trades ~170 ms / 512 MiB of extra spawn time
117
+ for steady-state BRANCH latency on the first user-visible
118
+ BRANCH (avoids the 2-9× cold-cache penalty documented in
119
+ ``bench/pause-window/RESULTS-v0.2.md``).
120
+
110
121
  Returns the list of SandboxInfo dicts (id, snapshot_tag, netns,
111
122
  guest_addr, created_at_unix, pid, memory_limit_mib).
112
123
  """
@@ -117,6 +128,8 @@ class Controller:
117
128
  }
118
129
  if memory_limit_mib is not None:
119
130
  body["memory_limit_mib"] = memory_limit_mib
131
+ if prewarm:
132
+ body["prewarm"] = True
120
133
  return self._request("POST", "/v1/sandboxes", body)
121
134
 
122
135
  def list_sandboxes(self) -> list[dict]:
@@ -131,13 +144,35 @@ class Controller:
131
144
  """``DELETE /v1/sandboxes/:id`` — terminate one sandbox."""
132
145
  self._request("DELETE", f"/v1/sandboxes/{sandbox_id}")
133
146
 
134
- def branch_sandbox(self, sandbox_id: str, tag: Optional[str] = None) -> dict:
147
+ def branch_sandbox(
148
+ self,
149
+ sandbox_id: str,
150
+ tag: Optional[str] = None,
151
+ diff: bool = False,
152
+ measure_diff: bool = False,
153
+ ) -> dict:
135
154
  """``POST /v1/sandboxes/:id/branch`` — pause + snapshot + resume.
136
155
 
156
+ Parameters
157
+ ----------
158
+ diff:
159
+ v0.3+: use Firecracker Diff snapshot mode. The source's
160
+ pause window collapses to the Diff write only (~200 ms
161
+ for an idle source; 6-15× speedup on typical agent
162
+ workloads; up to 143× on a 4 GiB sandbox on commodity
163
+ SSD — see ``bench/pause-window/RESULTS-v0.3.md``). Multi-
164
+ BRANCH on the same source is supported in v0.3.1+ via
165
+ the previous-output chain (``last_branch_memory_path``).
166
+ measure_diff:
167
+ v0.3+: measurement-only hook. Take a Diff snapshot inside
168
+ the existing Full pause to report what diff would have
169
+ cost, without changing semantics. Mutually exclusive with
170
+ ``diff`` (daemon returns 400 if both are true).
171
+
137
172
  The source sandbox is paused for the duration of the snapshot
138
- write (typically 0.5-8 s depending on memory image size),
139
- then resumed. The returned snapshot is independent of the
140
- source's lifecycle.
173
+ write typically 0.5-8 s for Full, ~200 ms for Diff — then
174
+ resumed. The returned snapshot is independent of the source's
175
+ lifecycle.
141
176
 
142
177
  Returns a SnapshotInfo dict; pass its ``tag`` to
143
178
  ``spawn_sandboxes`` to fork grandchildren from the branch.
@@ -145,6 +180,10 @@ class Controller:
145
180
  body: dict[str, Any] = {}
146
181
  if tag is not None:
147
182
  body["tag"] = tag
183
+ if diff:
184
+ body["diff"] = True
185
+ if measure_diff:
186
+ body["measure_diff"] = True
148
187
  return self._request("POST", f"/v1/sandboxes/{sandbox_id}/branch", body)
149
188
 
150
189
  def exec_command(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: forkd
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Open-source fork-on-write microVM sandbox primitive (E2B-compatible surface)
5
5
  Author-email: Deeplethe <info@deeplethe.com>
6
6
  License: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "forkd"
7
- version = "0.3.1"
7
+ version = "0.3.2"
8
8
  description = "Open-source fork-on-write microVM sandbox primitive (E2B-compatible surface)"
9
9
  readme = "README.md"
10
10
  authors = [{name = "Deeplethe", email = "info@deeplethe.com"}]
File without changes
File without changes
File without changes
File without changes