-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
92 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package groupcache | ||
|
||
// ErrNotFound should be returned from an implementation of `GetterFunc` to indicate the | ||
// requested value is not available. When remote HTTP calls are made to retrieve values from | ||
// other groupcache instances, returning this error will indicate to groupcache that the | ||
// value requested is not available, and it should NOT attempt to call `GetterFunc` locally. | ||
type ErrNotFound struct { | ||
Msg string | ||
} | ||
|
||
func (e *ErrNotFound) Error() string { | ||
return e.Msg | ||
} | ||
|
||
func (e *ErrNotFound) Is(target error) bool { | ||
_, ok := target.(*ErrNotFound) | ||
return ok | ||
} | ||
|
||
// ErrRemoteCall is returned from `group.Get()` when an error that is not a `ErrNotFound` | ||
// is returned during a remote HTTP instance call | ||
type ErrRemoteCall struct { | ||
Msg string | ||
} | ||
|
||
func (e *ErrRemoteCall) Error() string { | ||
return e.Msg | ||
} | ||
|
||
func (e *ErrRemoteCall) Is(target error) bool { | ||
_, ok := target.(*ErrRemoteCall) | ||
return ok | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters