Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EOL mount_refresh_interval #165

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions option/virtual_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,13 @@ const (
type VirtualInstanceOptions struct {
Description *string
Size *string
MountRefreshInterval *time.Duration
AutoSuspend *time.Duration
EnableRemountOnResume *bool
Name *string
}

type VirtualInstanceOption func(*VirtualInstanceOptions)

// WithMountRefreshInterval is used to optionally set the mount refresh interval. Setting it to 0 means
// it will be a continuous refresh, but then WithContinuousMountRefresh should be used instead. Not specifying
// a mount refresh interval will make it never refresh, and should only be used for static collections.
func WithMountRefreshInterval(interval time.Duration) VirtualInstanceOption {
return func(o *VirtualInstanceOptions) {
o.MountRefreshInterval = &interval
}
}

// WithContinuousMountRefresh is used to set the mount refresh interval to a continuous refresh.
func WithContinuousMountRefresh() VirtualInstanceOption {
return func(o *VirtualInstanceOptions) {
var zero time.Duration
o.MountRefreshInterval = &zero
}
}

// WithNoMountRefresh disables mount refresh.
func WithNoMountRefresh() VirtualInstanceOption {
return func(o *VirtualInstanceOptions) {
o.MountRefreshInterval = nil
}
}

// WithRemountOnResume sets remount on Virtual Instance resume.
func WithRemountOnResume(remount bool) VirtualInstanceOption {
return func(o *VirtualInstanceOptions) {
Expand Down
8 changes: 0 additions & 8 deletions virtual_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ func (rc *RockClient) CreateVirtualInstance(ctx context.Context, name string,
zl.Info().Int32("s", s).Dur("d", *opts.AutoSuspend).Msg("auto suspend")
req.AutoSuspendSeconds = &s
}
if opts.MountRefreshInterval != nil {
s := int32(opts.MountRefreshInterval.Seconds())
req.MountRefreshIntervalSeconds = &s
}
if opts.EnableRemountOnResume != nil {
req.EnableRemountOnResume = opts.EnableRemountOnResume
}
Expand Down Expand Up @@ -161,10 +157,6 @@ func (rc *RockClient) UpdateVirtualInstance(ctx context.Context, vID string,
s := int32(opts.AutoSuspend.Seconds())
req.AutoSuspendSeconds = &s
}
if opts.MountRefreshInterval != nil {
s := int32(opts.MountRefreshInterval.Seconds())
req.MountRefreshIntervalSeconds = &s
}
if opts.EnableRemountOnResume != nil {
req.EnableRemountOnResume = opts.EnableRemountOnResume
}
Expand Down
1 change: 0 additions & 1 deletion virtual_instances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ func (s *VirtualInstanceIntegrationSuite) TestVirtualInstance_0_Create() {

vi, err := rc.CreateVirtualInstance(ctx, s.name,
option.WithVirtualInstanceSize(option.SizeSmall),
option.WithNoMountRefresh(),
option.WithRemountOnResume(true),
option.WithAutoSuspend(15*time.Minute),
)
Expand Down