daytona 0.187.0 → 0.189.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '04875fe29d151906d0c02df13221402dcba8e38f449806357e23ac3dd786d360'
4
- data.tar.gz: 4afdd26872a7dbf6c5417229239f3a8b904668d6c23836e7956ca463158ed79d
3
+ metadata.gz: 17846836c31939fe3ff022eb6f504abf3bc3cae0133a1e918723a8bda8f32baf
4
+ data.tar.gz: b26c47c2c367550d6b54d390866200011ebb6f11f28e34a9591fa645b5034aef
5
5
  SHA512:
6
- metadata.gz: 4b370ef5ce8b5b13ef506a32882bbd9785d0e2b95432212094bca54a7e289db8c39f8d199a582b64f3bedbe91955db86a47b03498d8f325ff3e00a841392e052
7
- data.tar.gz: 2a49ff82844e0d734fe1b6e1c7bdee82c7c2a4bf0d05d461b1e601db14c79820b52d0b96a73c4f9149b0573522bc1aa015f7aee88a7dd7e19d2306ae4efca101
6
+ metadata.gz: 1d5db385668226ad0a6f0afd9358e5b04864b274c7609689391a07fcc5fb73933f7ff53dff3cbac74527332a4bc1f578684e53b21138a18d4590bc3700688353
7
+ data.tar.gz: 46a0c8ff02abfcdbf7494564718b47c5bd2ace286249343811c1899822b857361eee87587705b3b48382c852d0afdea430f05af6109552dfbdac0de53d9c1a61
@@ -546,6 +546,22 @@ module Daytona
546
546
  ) { wait_for_snapshot_complete }
547
547
  end
548
548
 
549
+ # Pauses the Sandbox, freezing all running processes.
550
+ # The Sandbox will enter a 'pausing' state and transition to 'paused' when complete.
551
+ #
552
+ # @param timeout [Numeric] Maximum wait time in seconds (defaults to 60 s)
553
+ # @return [void]
554
+ def pause(timeout: DEFAULT_TIMEOUT)
555
+ with_timeout(
556
+ timeout:,
557
+ message: "Sandbox #{id} failed to pause within the #{timeout} seconds timeout period",
558
+ setup: proc {
559
+ sandbox_api.pause_sandbox(id)
560
+ refresh
561
+ }
562
+ ) { wait_for_pause_complete }
563
+ end
564
+
549
565
  instrument :archive, :auto_archive_interval=, :auto_delete_interval=, :auto_stop_interval=,
550
566
  :update_network_settings,
551
567
  :create_ssh_access, :delete, :get_user_home_dir, :get_work_dir, :labels=,
@@ -553,7 +569,7 @@ module Daytona
553
569
  :refresh, :refresh_activity, :revoke_ssh_access, :start, :recover, :stop,
554
570
  :create_lsp_server, :validate_ssh_access, :wait_for_sandbox_start,
555
571
  :wait_for_sandbox_stop, :resize, :wait_for_resize_complete,
556
- :experimental_fork, :experimental_create_snapshot,
572
+ :experimental_fork, :experimental_create_snapshot, :pause,
557
573
  component: 'Sandbox'
558
574
 
559
575
  private
@@ -703,5 +719,25 @@ module Daytona
703
719
  end
704
720
  end
705
721
  end
722
+
723
+ def wait_for_pause_complete
724
+ interval = INITIAL_POLL_INTERVAL
725
+ start_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
726
+ while state == DaytonaApiClient::SandboxState::PAUSING
727
+ refresh
728
+
729
+ if [DaytonaApiClient::SandboxState::ERROR, DaytonaApiClient::SandboxState::BUILD_FAILED].include?(state)
730
+ raise Sdk::Error,
731
+ "Sandbox #{id} pause failed with state: #{state}, error reason: #{error_reason}"
732
+ end
733
+
734
+ break if state != DaytonaApiClient::SandboxState::PAUSING
735
+
736
+ sleep(interval)
737
+ if ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - start_time > 5
738
+ interval = [interval * BACKOFF_MULTIPLIER, MAX_POLL_INTERVAL].min
739
+ end
740
+ end
741
+ end
706
742
  end
707
743
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Daytona
7
7
  module Sdk
8
- VERSION = '0.187.0'
8
+ VERSION = '0.189.0'
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daytona
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.187.0
4
+ version: 0.189.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daytona Platforms Inc.
@@ -85,28 +85,28 @@ dependencies:
85
85
  requirements:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 0.187.0
88
+ version: 0.189.0
89
89
  type: :runtime
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 0.187.0
95
+ version: 0.189.0
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: daytona_toolbox_api_client
98
98
  requirement: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 0.187.0
102
+ version: 0.189.0
103
103
  type: :runtime
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 0.187.0
109
+ version: 0.189.0
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: dotenv
112
112
  requirement: !ruby/object:Gem::Requirement