@@ -66,7 +66,7 @@ func (b *DeploymentBundle) Bind(ctx context.Context, client *databricks.Workspac
6666 // The state is opened without a DMS client, so the writes below record nothing;
6767 // phases.Bind and phases.Unbind refuse to run at all when recording is enabled.
6868 var checkStateDB dstate.DeploymentState
69- if err := checkStateDB .Open (ctx , statePath , dstate .WithRecovery ( true ) , dstate .WithWrite ( false ), dstate . WithDeploymentHistory ( false ), dstate.OpenDmsArgs {}); err != nil {
69+ if err := checkStateDB .Open (ctx , statePath , dstate .ReadingFile , dstate .WithRecovery ( true ), dstate.OpenDmsArgs {}); err != nil {
7070 // State that cannot be read is not the same as state without a binding:
7171 // the resource may well be managed already, and binding on top of it
7272 // would take over a resource whose ownership was never checked. A state
@@ -95,7 +95,7 @@ func (b *DeploymentBundle) Bind(ctx context.Context, client *databricks.Workspac
9595 }
9696
9797 // Open temp state
98- err := b .StateDB .Open (ctx , tmpStatePath , dstate .WithRecovery ( false ) , dstate .WithWrite ( true ), dstate . WithDeploymentHistory (false ), dstate.OpenDmsArgs {})
98+ err := b .StateDB .Open (ctx , tmpStatePath , dstate .WritingFile , dstate .WithRecovery (false ), dstate.OpenDmsArgs {})
9999 if err != nil {
100100 os .Remove (tmpStatePath )
101101 return nil , err
@@ -118,7 +118,7 @@ func (b *DeploymentBundle) Bind(ctx context.Context, client *databricks.Workspac
118118 log .Infof (ctx , "Bound %s to id=%s (in temp state)" , resourceKey , resourceID )
119119
120120 // First plan + update: populate state with resolved config
121- err = b .StateDB .Open (ctx , tmpStatePath , dstate .WithRecovery ( true ) , dstate .WithWrite ( false ), dstate . WithDeploymentHistory ( false ), dstate.OpenDmsArgs {})
121+ err = b .StateDB .Open (ctx , tmpStatePath , dstate .ReadingFile , dstate .WithRecovery ( true ), dstate.OpenDmsArgs {})
122122 if err != nil {
123123 os .Remove (tmpStatePath )
124124 return nil , err
@@ -167,7 +167,7 @@ func (b *DeploymentBundle) Bind(ctx context.Context, client *databricks.Workspac
167167 return nil , fmt .Errorf ("compacting state: %w" , err )
168168 }
169169
170- err = b .StateDB .Open (ctx , tmpStatePath , dstate .WithRecovery ( true ) , dstate .WithWrite (true ), dstate . WithDeploymentHistory ( false ), dstate.OpenDmsArgs {})
170+ err = b .StateDB .Open (ctx , tmpStatePath , dstate .WritingFile , dstate .WithRecovery (true ), dstate.OpenDmsArgs {})
171171 if err != nil {
172172 os .Remove (tmpStatePath )
173173 return nil , err
@@ -187,7 +187,7 @@ func (b *DeploymentBundle) Bind(ctx context.Context, client *databricks.Workspac
187187 }
188188
189189 // Second plan: this is the plan to present to the user (change between remote resource and config)
190- err = b .StateDB .Open (ctx , tmpStatePath , dstate .WithRecovery ( true ) , dstate .WithWrite ( false ), dstate . WithDeploymentHistory ( false ), dstate.OpenDmsArgs {})
190+ err = b .StateDB .Open (ctx , tmpStatePath , dstate .ReadingFile , dstate .WithRecovery ( true ), dstate.OpenDmsArgs {})
191191 if err != nil {
192192 os .Remove (tmpStatePath )
193193 return nil , err
@@ -237,7 +237,7 @@ func (result *BindResult) Cancel() {
237237// Unbind removes a resource from direct engine state without deleting
238238// the workspace resource. Also removes associated permissions/grants entries.
239239func (b * DeploymentBundle ) Unbind (ctx context.Context , statePath , resourceKey string ) error {
240- err := b .StateDB .Open (ctx , statePath , dstate .WithRecovery ( true ) , dstate .WithWrite (true ), dstate . WithDeploymentHistory ( false ), dstate.OpenDmsArgs {})
240+ err := b .StateDB .Open (ctx , statePath , dstate .WritingFile , dstate .WithRecovery (true ), dstate.OpenDmsArgs {})
241241 if err != nil {
242242 if errors .Is (err , dstate .ErrUnsettingRecording ) {
243243 return errors .New ("unbind is not supported for a bundle target that records deployment history" )
0 commit comments