MCPcopy Create free account
hub / github.com/blobcache/blobcache / CreateVolume

Method CreateVolume

src/internal/backend/remotebe/peer.go:63–72  ·  view source on GitHub ↗

Create creates a new volume on the remote

(ctx context.Context, peer blobcache.NodeID, vspec blobcache.VolumeSpec)

Source from the content-addressed store, hash-verified

61
62// Create creates a new volume on the remote
63func (ps *PeerSystem) CreateVolume(ctx context.Context, peer blobcache.NodeID, vspec blobcache.VolumeSpec) (*Volume, error) {
64 return withEndpoint(ctx, ps.locator, peer, func(ep blobcache.Endpoint) (*Volume, error) {
65 vol, err := ps.inner.CreateVolume(ctx, ep, vspec)
66 if err != nil {
67 return nil, err
68 }
69 vol.isPeer = true
70 return vol, nil
71 })
72}
73
74func withEndpoint[T any](ctx context.Context, loc PeerLocator, peer blobcache.NodeID, fn func(blobcache.Endpoint) (T, error)) (T, error) {
75 var ret T

Callers

nothing calls this directly

Calls 2

withEndpointFunction · 0.85
CreateVolumeMethod · 0.65

Tested by

no test coverage detected