-
Notifications
You must be signed in to change notification settings - Fork 337
/
steward.go
34 lines (27 loc) · 893 Bytes
/
steward.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2021 The Swarm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package mock
import (
"context"
"github.com/ethersphere/bee/pkg/swarm"
)
// Steward represents steward.Interface mock.
type Steward struct {
addr swarm.Address
}
// Reupload implements steward.Interface Reupload method.
// The given address is recorded.
func (s *Steward) Reupload(_ context.Context, addr swarm.Address) error {
s.addr = addr
return nil
}
// IsRetrievable implements steward.Interface IsRetrievable method.
// The method always returns true.
func (s *Steward) IsRetrievable(_ context.Context, addr swarm.Address) (bool, error) {
return addr.Equal(s.addr), nil
}
// LastAddress returns the last address given to the Reupload method call.
func (s *Steward) LastAddress() swarm.Address {
return s.addr
}