This file is indexed.

/usr/share/gocode/src/github.com/docker/libkv/store/mock/mock.go is in golang-github-docker-libkv-dev 0.1.0-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package mock

import (
	"github.com/docker/libkv/store"
	"github.com/stretchr/testify/mock"
)

// Mock store. Mocks all Store functions using testify.Mock
type Mock struct {
	mock.Mock

	// Endpoints passed to InitializeMock
	Endpoints []string

	// Options passed to InitializeMock
	Options *store.Config
}

// New creates a Mock store
func New(endpoints []string, options *store.Config) (store.Store, error) {
	s := &Mock{}
	s.Endpoints = endpoints
	s.Options = options
	return s, nil
}

// Put mock
func (s *Mock) Put(key string, value []byte, opts *store.WriteOptions) error {
	args := s.Mock.Called(key, value, opts)
	return args.Error(0)
}

// Get mock
func (s *Mock) Get(key string) (*store.KVPair, error) {
	args := s.Mock.Called(key)
	return args.Get(0).(*store.KVPair), args.Error(1)
}

// Delete mock
func (s *Mock) Delete(key string) error {
	args := s.Mock.Called(key)
	return args.Error(0)
}

// Exists mock
func (s *Mock) Exists(key string) (bool, error) {
	args := s.Mock.Called(key)
	return args.Bool(0), args.Error(1)
}

// Watch mock
func (s *Mock) Watch(key string, stopCh <-chan struct{}) (<-chan *store.KVPair, error) {
	args := s.Mock.Called(key, stopCh)
	return args.Get(0).(<-chan *store.KVPair), args.Error(1)
}

// WatchTree mock
func (s *Mock) WatchTree(prefix string, stopCh <-chan struct{}) (<-chan []*store.KVPair, error) {
	args := s.Mock.Called(prefix, stopCh)
	return args.Get(0).(chan []*store.KVPair), args.Error(1)
}

// NewLock mock
func (s *Mock) NewLock(key string, options *store.LockOptions) (store.Locker, error) {
	args := s.Mock.Called(key, options)
	return args.Get(0).(store.Locker), args.Error(1)
}

// List mock
func (s *Mock) List(prefix string) ([]*store.KVPair, error) {
	args := s.Mock.Called(prefix)
	return args.Get(0).([]*store.KVPair), args.Error(1)
}

// DeleteTree mock
func (s *Mock) DeleteTree(prefix string) error {
	args := s.Mock.Called(prefix)
	return args.Error(0)
}

// AtomicPut mock
func (s *Mock) AtomicPut(key string, value []byte, previous *store.KVPair, opts *store.WriteOptions) (bool, *store.KVPair, error) {
	args := s.Mock.Called(key, value, previous, opts)
	return args.Bool(0), args.Get(1).(*store.KVPair), args.Error(2)
}

// AtomicDelete mock
func (s *Mock) AtomicDelete(key string, previous *store.KVPair) (bool, error) {
	args := s.Mock.Called(key, previous)
	return args.Bool(0), args.Error(1)
}

// Lock mock implementation of Locker
type Lock struct {
	mock.Mock
}

// Lock mock
func (l *Lock) Lock(stopCh chan struct{}) (<-chan struct{}, error) {
	args := l.Mock.Called(stopCh)
	return args.Get(0).(<-chan struct{}), args.Error(1)
}

// Unlock mock
func (l *Lock) Unlock() error {
	args := l.Mock.Called()
	return args.Error(0)
}

// Close mock
func (s *Mock) Close() {
	return
}