Skip to content

Commit 24ce1b9

Browse files
committed
fix inconsistent receiver name
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent c8545c3 commit 24ce1b9

1 file changed

Lines changed: 35 additions & 35 deletions

File tree

zfs.go

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ func destroySnapshot(dataset *zfs.Dataset) error {
102102
//
103103
// Should be used for parent resolution, existence checks and to discern
104104
// the kind of snapshot.
105-
func (z *snapshotter) Stat(ctx context.Context, key string) (snapshots.Info, error) {
106-
ctx, t, err := z.ms.TransactionContext(ctx, false)
105+
func (s *snapshotter) Stat(ctx context.Context, key string) (snapshots.Info, error) {
106+
ctx, t, err := s.ms.TransactionContext(ctx, false)
107107
if err != nil {
108108
return snapshots.Info{}, err
109109
}
@@ -117,12 +117,12 @@ func (z *snapshotter) Stat(ctx context.Context, key string) (snapshots.Info, err
117117
}
118118

119119
// Usage retrieves the disk usage of the top-level snapshot.
120-
func (z *snapshotter) Usage(ctx context.Context, key string) (snapshots.Usage, error) {
121-
return z.usage(ctx, key)
120+
func (s *snapshotter) Usage(ctx context.Context, key string) (snapshots.Usage, error) {
121+
return s.usage(ctx, key)
122122
}
123123

124-
func (z *snapshotter) usage(ctx context.Context, key string) (snapshots.Usage, error) {
125-
ctx, t, err := z.ms.TransactionContext(ctx, false)
124+
func (s *snapshotter) usage(ctx context.Context, key string) (snapshots.Usage, error) {
125+
ctx, t, err := s.ms.TransactionContext(ctx, false)
126126
if err != nil {
127127
return snapshots.Usage{}, err
128128
}
@@ -134,7 +134,7 @@ func (z *snapshotter) usage(ctx context.Context, key string) (snapshots.Usage, e
134134
}
135135

136136
if info.Kind == snapshots.KindActive {
137-
activeName := filepath.Join(z.dataset.Name, id)
137+
activeName := filepath.Join(s.dataset.Name, id)
138138
sDataset, err := zfs.GetDataset(activeName)
139139
if err != nil {
140140
return snapshots.Usage{}, err
@@ -154,25 +154,25 @@ func (z *snapshotter) usage(ctx context.Context, key string) (snapshots.Usage, e
154154
}
155155

156156
// Walk the committed snapshots.
157-
func (z *snapshotter) Walk(ctx context.Context, fn snapshots.WalkFunc, filters ...string) error {
158-
ctx, t, err := z.ms.TransactionContext(ctx, false)
157+
func (s *snapshotter) Walk(ctx context.Context, fn snapshots.WalkFunc, filters ...string) error {
158+
ctx, t, err := s.ms.TransactionContext(ctx, false)
159159
if err != nil {
160160
return err
161161
}
162162
defer t.Rollback() //nolint:errcheck
163163
return storage.WalkInfo(ctx, fn, filters...)
164164
}
165165

166-
func (z *snapshotter) Prepare(ctx context.Context, key, parent string, opts ...snapshots.Opt) ([]mount.Mount, error) {
167-
return z.createSnapshot(ctx, snapshots.KindActive, key, parent, opts...)
166+
func (s *snapshotter) Prepare(ctx context.Context, key, parent string, opts ...snapshots.Opt) ([]mount.Mount, error) {
167+
return s.createSnapshot(ctx, snapshots.KindActive, key, parent, opts...)
168168
}
169169

170-
func (z *snapshotter) View(ctx context.Context, key, parent string, opts ...snapshots.Opt) ([]mount.Mount, error) {
171-
return z.createSnapshot(ctx, snapshots.KindView, key, parent, opts...)
170+
func (s *snapshotter) View(ctx context.Context, key, parent string, opts ...snapshots.Opt) ([]mount.Mount, error) {
171+
return s.createSnapshot(ctx, snapshots.KindView, key, parent, opts...)
172172
}
173173

174-
func (z *snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, key, parent string, opts ...snapshots.Opt) ([]mount.Mount, error) {
175-
ctx, t, err := z.ms.TransactionContext(ctx, true)
174+
func (s *snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, key, parent string, opts ...snapshots.Opt) ([]mount.Mount, error) {
175+
ctx, t, err := s.ms.TransactionContext(ctx, true)
176176
if err != nil {
177177
return nil, err
178178
}
@@ -189,15 +189,15 @@ func (z *snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, k
189189
return nil, err
190190
}
191191

192-
targetName := filepath.Join(z.dataset.Name, a.ID)
192+
targetName := filepath.Join(s.dataset.Name, a.ID)
193193
var target *zfs.Dataset
194194
if len(a.ParentIDs) == 0 {
195195
target, err = createFilesystem(targetName)
196196
if err != nil {
197197
return nil, err
198198
}
199199
} else {
200-
parent0Name := filepath.Join(z.dataset.Name, a.ParentIDs[0]) + "@" + snapshotSuffix
200+
parent0Name := filepath.Join(s.dataset.Name, a.ParentIDs[0]) + "@" + snapshotSuffix
201201
parent0, err := zfs.GetDataset(parent0Name)
202202
if err != nil {
203203
return nil, err
@@ -217,10 +217,10 @@ func (z *snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, k
217217
return nil, err
218218
}
219219
readonly := kind == snapshots.KindView
220-
return z.mounts(target, readonly)
220+
return s.mounts(target, readonly)
221221
}
222222

223-
func (z *snapshotter) mounts(dataset *zfs.Dataset, readonly bool) ([]mount.Mount, error) {
223+
func (s *snapshotter) mounts(dataset *zfs.Dataset, readonly bool) ([]mount.Mount, error) {
224224
var options []string
225225
if readonly {
226226
options = append(options, "ro")
@@ -234,13 +234,13 @@ func (z *snapshotter) mounts(dataset *zfs.Dataset, readonly bool) ([]mount.Mount
234234
}, nil
235235
}
236236

237-
func (z *snapshotter) Commit(ctx context.Context, name, key string, opts ...snapshots.Opt) (err error) {
238-
usage, err := z.usage(ctx, key)
237+
func (s *snapshotter) Commit(ctx context.Context, name, key string, opts ...snapshots.Opt) (err error) {
238+
usage, err := s.usage(ctx, key)
239239
if err != nil {
240240
return fmt.Errorf("failed to compute usage: %w", err)
241241
}
242242

243-
ctx, t, err := z.ms.TransactionContext(ctx, true)
243+
ctx, t, err := s.ms.TransactionContext(ctx, true)
244244
if err != nil {
245245
return err
246246
}
@@ -257,7 +257,7 @@ func (z *snapshotter) Commit(ctx context.Context, name, key string, opts ...snap
257257
return fmt.Errorf("failed to commit: %w", err)
258258
}
259259

260-
activeName := filepath.Join(z.dataset.Name, id)
260+
activeName := filepath.Join(s.dataset.Name, id)
261261
active, err := zfs.GetDataset(activeName)
262262
if err != nil {
263263
return err
@@ -282,28 +282,28 @@ func (z *snapshotter) Commit(ctx context.Context, name, key string, opts ...snap
282282
// called on an read-write or readonly transaction.
283283
//
284284
// This can be used to recover mounts after calling View or Prepare.
285-
func (z *snapshotter) Mounts(ctx context.Context, key string) ([]mount.Mount, error) {
286-
ctx, t, err := z.ms.TransactionContext(ctx, false)
285+
func (s *snapshotter) Mounts(ctx context.Context, key string) ([]mount.Mount, error) {
286+
ctx, t, err := s.ms.TransactionContext(ctx, false)
287287
if err != nil {
288288
return nil, err
289289
}
290-
s, err := storage.GetSnapshot(ctx, key)
290+
snapshot, err := storage.GetSnapshot(ctx, key)
291291
t.Rollback() //nolint:errcheck
292292
if err != nil {
293293
return nil, fmt.Errorf("failed to get active snapshot: %w", err)
294294
}
295-
sName := filepath.Join(z.dataset.Name, s.ID)
295+
sName := filepath.Join(s.dataset.Name, snapshot.ID)
296296
sDataset, err := zfs.GetDataset(sName)
297297
if err != nil {
298298
return nil, err
299299
}
300-
return z.mounts(sDataset, false)
300+
return s.mounts(sDataset, false)
301301
}
302302

303303
// Remove abandons the transaction identified by key. All resources
304304
// associated with the key will be removed.
305-
func (z *snapshotter) Remove(ctx context.Context, key string) (err error) {
306-
ctx, t, err := z.ms.TransactionContext(ctx, true)
305+
func (s *snapshotter) Remove(ctx context.Context, key string) (err error) {
306+
ctx, t, err := s.ms.TransactionContext(ctx, true)
307307
if err != nil {
308308
return err
309309
}
@@ -321,7 +321,7 @@ func (z *snapshotter) Remove(ctx context.Context, key string) (err error) {
321321
return fmt.Errorf("failed to remove snapshot: %w", err)
322322
}
323323

324-
datasetName := filepath.Join(z.dataset.Name, id)
324+
datasetName := filepath.Join(s.dataset.Name, id)
325325
if k == snapshots.KindCommitted {
326326
snapshotName := datasetName + "@" + snapshotSuffix
327327
snapshot, err := zfs.GetDataset(snapshotName)
@@ -344,8 +344,8 @@ func (z *snapshotter) Remove(ctx context.Context, key string) (err error) {
344344
return err
345345
}
346346

347-
func (o *snapshotter) Update(ctx context.Context, info snapshots.Info, fieldpaths ...string) (snapshots.Info, error) {
348-
ctx, t, err := o.ms.TransactionContext(ctx, true)
347+
func (s *snapshotter) Update(ctx context.Context, info snapshots.Info, fieldpaths ...string) (snapshots.Info, error) {
348+
ctx, t, err := s.ms.TransactionContext(ctx, true)
349349
if err != nil {
350350
return snapshots.Info{}, err
351351
}
@@ -363,6 +363,6 @@ func (o *snapshotter) Update(ctx context.Context, info snapshots.Info, fieldpath
363363
return info, nil
364364
}
365365

366-
func (o *snapshotter) Close() error {
367-
return o.ms.Close()
366+
func (s *snapshotter) Close() error {
367+
return s.ms.Close()
368368
}

0 commit comments

Comments
 (0)