Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Azure/peerd
/ functions
Functions
350 in github.com/Azure/peerd
⨍
Functions
350
◇
Types & classes
50
↓ 51 callers
Method
Set
Set sets a new entry or updates an existing one. Set adds or updates an entry in the SyncMap with the specified key. If the key already exists in the
pkg/cache/syncmap.go:32
↓ 31 callers
Method
Get
Get retrieves the value associated with the given key from the SyncMap. It returns the value and a boolean indicating whether the key was found.
pkg/cache/syncmap.go:21
↓ 29 callers
Function
NewMockRouter
(resolver map[string][]string)
pkg/discovery/routing/mocks/router.go:40
↓ 18 callers
Method
Close
Close closes the router.
pkg/discovery/routing/interface.go:28
↓ 14 callers
Function
newRandomStringN
newRandomStringN creates a new random string of length n.
pkg/cache/main_test.go:63
↓ 11 callers
Function
NewFilesStore
NewFilesStore creates a new store.
pkg/files/store/store.go:26
↓ 10 callers
Method
Log
Log returns the logger with context for this reader.
pkg/discovery/content/reader/interface.go:20
↓ 9 callers
Method
Size
Size gets the size of the file.
pkg/cache/interface.go:8
↓ 8 callers
Method
Fstat
Fstat returns the size of the file.
pkg/files/store/file.go:77
↓ 8 callers
Function
NewReader
NewReader creates a new remote reader.
pkg/discovery/content/reader/reader.go:288
↓ 8 callers
Method
Read
Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered.
pkg/files/store/interface.go:34
↓ 8 callers
Function
newItem
newItem creates a new cache item that is ready to be filled.
pkg/cache/item.go:119
↓ 7 callers
Function
FromContext
FromContext creates a new context from the given gin context.
pkg/context/context.go:62
↓ 7 callers
Method
ID
ID implements host.Host.
pkg/discovery/routing/router_test.go:270
↓ 7 callers
Function
New
New creates a new network interface for communicating with peers.
pkg/peernet/network.go:104
↓ 6 callers
Function
FetchFile
Fetchfile gets the content of a file from the given offset using a remote reader.
pkg/files/files.go:26
↓ 6 callers
Method
Leader
Leader gets the address of the elected leader.
pkg/k8s/election/election.go:23
↓ 6 callers
Function
NewPromMetrics
NewPromMetrics creates a new instance of promMetrics.
pkg/metrics/prometheus.go:47
↓ 6 callers
Function
NewSyncMap
NewSyncMap creates a new SyncMap with the specified maximum number of entries. If the maximum number of entries is less than or equal to 0, it will be
pkg/cache/syncmap.go:66
↓ 6 callers
Function
WithContext
WithContext returns a new context with a metrics recorder.
pkg/metrics/interface.go:30
↓ 5 callers
Method
Addrs
Addrs implements host.Host.
pkg/discovery/routing/router_test.go:245
↓ 5 callers
Method
Eventf
Eventf implements record.EventRecorder.
pkg/k8s/events/events_test.go:177
↓ 5 callers
Function
FromContext
FromContext returns the event recorder from the context.
pkg/k8s/events/events.go:77
↓ 5 callers
Method
GetOrCreate
GetOrCreate gets the cached value if available, otherwise downloads the file.
pkg/cache/interface.go:17
↓ 5 callers
Method
Handle
Handle handles a request for a file.
pkg/handlers/files/handler.go:23
↓ 5 callers
Function
NewCache
NewCache creates a new cache of files. cacheBlockSize is the fixed size of the cache block in bytes, and is used to evaluate the cost of each item in
pkg/cache/filecache.go:152
↓ 5 callers
Method
PreadRemote
PreadRemote is like pread but to a remote file.
pkg/discovery/content/reader/interface.go:14
↓ 5 callers
Method
ReadAt
ReadAt reads len(p) bytes from the File starting at byte offset off. It returns the number of bytes read and the error, if any.
pkg/files/store/file.go:112
↓ 5 callers
Method
Seek
Seek sets the current file offset.
pkg/files/store/file.go:63
↓ 5 callers
Method
doP2p
doP2p tries to resolve the key in the p2p network and if successful, it will perform the operation on the peer, and return the result.
pkg/discovery/content/reader/reader.go:101
↓ 5 callers
Function
randomBytesN
(n int)
pkg/cache/item_test.go:231
↓ 5 callers
Method
transportFor
transportFor returns a single use transport for outbound connection to the given peer. The peer is expected to provide a valid certificate. If pid is
pkg/peernet/network.go:83
↓ 4 callers
Function
AlignDown
AlignDown will align down the x by align. For example: AlignDown(1, 2) = 0 AlignDown(29, 14) = 28
pkg/math/segments.go:32
↓ 4 callers
Method
Copy
Copy creates a copy of the context that can be safely used outside the request's scope.
pkg/context/context.go:67
↓ 4 callers
Function
FileChunkKey
1 Mib FileChunkKey returns the p2p lookup key for the given chunk of a file.
pkg/files/files.go:21
↓ 4 callers
Method
FstatRemote
FstatRemote stats a remote file.
pkg/discovery/content/reader/interface.go:17
↓ 4 callers
Function
Min64
Min64 returns the smaller of x or y.
pkg/math/compare.go:14
↓ 4 callers
Function
New
New build a new LeaderElection instance with the given name.
pkg/k8s/election/election.go:109
↓ 4 callers
Function
New
New creates a new files handler.
pkg/handlers/files/handler.go:80
↓ 4 callers
Function
NewMockReader
NewMockReader creates a new mock reader for testing purposes.
pkg/discovery/content/reader/mocks/reader.go:37
↓ 4 callers
Function
NewMockStore
(ctx context.Context, r routing.Router, fileCachePath string)
pkg/files/store/mockstore.go:22
↓ 4 callers
Function
NewRecorder
NewRecorder creates a new event recorder.
pkg/k8s/events/events.go:23
↓ 4 callers
Function
NewSegments
NewSegments creates a new Segments object.
pkg/math/segments.go:22
↓ 4 callers
Method
PutSize
PutSize sets size of the file.
pkg/cache/interface.go:11
↓ 4 callers
Method
RecordUpstreamResponse
RecordUpstreamResponse records the time it takes for an upstream to respond for a key.
pkg/metrics/interface.go:26
↓ 4 callers
Function
createContentId
createContentId creates a deterministic content id from the given key.
pkg/discovery/routing/router.go:236
↓ 4 callers
Method
getKey
(name string, offset int64)
pkg/cache/filecache.go:142
↓ 3 callers
Method
All
All provides a channel of all segments.
pkg/math/segments.go:37
↓ 3 callers
Method
Cache
()
pkg/files/store/mockstore.go:18
↓ 3 callers
Function
FillCorrelationId
FillCorrelationId fills the correlation ID in the context.
pkg/context/context.go:78
↓ 3 callers
Function
FromContext
FromContext returns the metrics recorder from the context.
pkg/metrics/interface.go:40
↓ 3 callers
Method
HTTPClientFor
HTTPClientFor returns an HTTP client which authenticates the given peer. If pid is empty, the client should work for any peer.
pkg/peernet/network.go:39
↓ 3 callers
Function
Handler
Server creates a new HTTP server.
pkg/handlers/root.go:21
↓ 3 callers
Method
ID
ID returns the peer ID of this host.
pkg/peernet/mocks/host.go:46
↓ 3 callers
Function
IsRequestFromAPeer
IsRequestFromAPeer indicates if the current request is from a peer.
pkg/context/context.go:73
↓ 3 callers
Function
Min
Min returns the smaller of x or y.
pkg/math/compare.go:22
↓ 3 callers
Method
Net
Net returns the network interface.
pkg/discovery/routing/interface.go:15
↓ 3 callers
Method
Open
Open opens the requested file and starts prefetching it. It also returns the size of the file.
pkg/files/store/interface.go:18
↓ 3 callers
Function
Provide
Provide advertises content availability to the DHT network. Runs in a blocking loop, listening for blob identifiers on filesChan and advertising them
pkg/discovery/content/provider/provider.go:25
↓ 3 callers
Method
RecordPeerDiscovery
RecordPeerDiscovery records the time it takes to discover a peer.
pkg/metrics/interface.go:20
↓ 3 callers
Method
RecordPeerResponse
RecordPeerResponse records the time it takes for a peer to respond for a key.
pkg/metrics/interface.go:23
↓ 3 callers
Method
RecordRequest
RecordRequest records the time it takes to process a request.
pkg/metrics/interface.go:17
↓ 3 callers
Method
Resolve
(ctx context.Context, key string, allowSelf bool, count int)
pkg/discovery/routing/mocks/router.go:57
↓ 3 callers
Method
fill
fill files the file with the given data.
pkg/cache/item.go:56
↓ 3 callers
Function
getPodNamespace
getPodNamespace returns the namespace in which the pod is running or the default namespace. Ref: https://kubernetes.io/docs/tasks/run-application/acce
pkg/k8s/k8s.go:62
↓ 3 callers
Function
newEngine
newEngine creates a new gin engine.
pkg/handlers/root.go:31
↓ 3 callers
Method
onNewLeader
onNewLeader is called when a new leader is elected. It updates the leaderElection instance with the new leader's identity.
pkg/k8s/election/election.go:90
↓ 3 callers
Function
parseDigestFromAzureUrl
parseDigestFromAzureUrl parses the digest from the given blob url or returns an error.
pkg/urlparser/azure.go:26
↓ 3 callers
Function
writeAll
writeAll writes the file.
pkg/cache/item.go:100
↓ 2 callers
Method
DefaultTLSConfig
DefaultTLSConfig creates a default TLS config. This config should not require client certificate verification.
pkg/peernet/network.go:31
↓ 2 callers
Method
Delete
Delete removes the entry with the specified key from the SyncMap. If the key does not exist, this method does nothing.
pkg/cache/syncmap.go:58
↓ 2 callers
Method
Exists
Exists checks if the given chunk of the file is already cached.
pkg/cache/interface.go:14
↓ 2 callers
Method
Key
Key tries to find the cache key for the requested content or returns empty.
pkg/files/store/interface.go:15
↓ 2 callers
Method
Len
Len returns the length of the slice
tests/random/math/reverse.go:14
↓ 2 callers
Method
Less
Less returns true if the element at index i is greater than the element at index j
tests/random/math/reverse.go:19
↓ 2 callers
Method
Log
Log returns the logger with context for this reader.
pkg/discovery/content/reader/reader.go:45
↓ 2 callers
Function
Logger
Logger gets the logger with request specific fields.
pkg/context/context.go:94
↓ 2 callers
Function
Max64
Max64 returns the larger of x or y.
pkg/math/compare.go:6
↓ 2 callers
Function
New
New returns a new Parser.
pkg/urlparser/parser.go:28
↓ 2 callers
Function
NewKubernetesInterface
NewKubernetesInterface creates a new interface for k8s API server. The current runtime environment is first assumed to be a pod and its identity is us
pkg/k8s/k8s.go:34
↓ 2 callers
Method
ParseDigest
ParseDigest parses the digest from the given URL. If none found, implementations should return an error.
pkg/urlparser/parser.go:14
↓ 2 callers
Function
PercentilesFloat64Reverse
PercentilesFloat64Reverse calculates the percentile of a slice of floats in reverse order. NOTE: The unit of each value of xs is 'bits' and the result
tests/random/math/math.go:13
↓ 2 callers
Method
PrivKey
PrivKey generates a new private key for the given peer.
pkg/peernet/mocks/peerstore.go:90
↓ 2 callers
Method
Provide
Provide provides the given keys to the network. This lets the k-closest peers to the key know that we are providing it.
pkg/discovery/routing/interface.go:25
↓ 2 callers
Function
RandomizedGroups
RandomizedGroups groups the given collection randomly into groups of size n
tests/random/math/math.go:38
↓ 2 callers
Method
Resolve
Resolve resolves the given key to a peer address.
pkg/discovery/routing/router.go:172
↓ 2 callers
Method
RoundTripperFor
RoundTripperFor returns an HTTP round tripper which authenticates the given peer. If pid is empty, the round tripper should work for any peer.
pkg/peernet/network.go:35
↓ 2 callers
Method
RunOrDie
RunOrDie runs the leader election.
pkg/k8s/election/election.go:20
↓ 2 callers
Method
Subscribe
Subscribe returns a channel that will be notified when a blob is added to the store.
pkg/files/store/interface.go:21
↓ 2 callers
Function
WithContext
WithContext returns a new context with an event recorder.
pkg/k8s/events/events.go:67
↓ 2 callers
Function
benchmark
benchmark runs the benchmark and returns the measured download speeds.
tests/random/random.go:101
↓ 2 callers
Method
bytes
bytes returns the file bytes.
pkg/cache/item.go:45
↓ 2 callers
Method
drop
drop deletes the underlying file.
pkg/cache/item.go:26
↓ 2 callers
Method
fill
fill fills the context with handler specific information.
pkg/handlers/files/handler.go:63
↓ 2 callers
Method
fstatRemote
fstatRemote stats the file.
pkg/discovery/content/reader/reader.go:187
↓ 2 callers
Method
leaderElectionConfig
leaderElectionConfig creates a new configuration for the leader election.
pkg/k8s/election/election.go:73
↓ 2 callers
Function
newHost
newHost creates a new Host from the given address.
pkg/discovery/routing/router.go:251
↓ 2 callers
Function
newRandomString
newRandomString creates a new random string.
pkg/cache/main_test.go:45
↓ 2 callers
Function
newRandomStringN
newRandomStringN creates a new random string of length n.
pkg/handlers/files/main_test.go:43
↓ 2 callers
Method
originRequest
originRequest will create a new request to origin.
pkg/discovery/content/reader/reader.go:259
next →
1–100 of 350, ranked by callers