MCPcopy
hub / github.com/kopia/kopia / handleRepoSupportedAlgorithms

Function handleRepoSupportedAlgorithms

internal/server/api_repo.go:243–272  ·  view source on GitHub ↗
(_ context.Context, _ requestContext)

Source from the content-addressed store, hash-verified

241}
242
243func handleRepoSupportedAlgorithms(_ context.Context, _ requestContext) (any, *apiError) {
244 res := &serverapi.SupportedAlgorithmsResponse{
245 DefaultHashAlgorithm: hashing.DefaultAlgorithm,
246 SupportedHashAlgorithms: toAlgorithmInfo(hashing.SupportedAlgorithms(), neverDeprecated),
247
248 DefaultEncryptionAlgorithm: encryption.DefaultAlgorithm,
249 SupportedEncryptionAlgorithms: toAlgorithmInfo(encryption.SupportedAlgorithms(false), neverDeprecated),
250
251 DefaultECCAlgorithm: ecc.DefaultAlgorithm,
252 SupportedECCAlgorithms: toAlgorithmInfo(ecc.SupportedAlgorithms(), neverDeprecated),
253
254 DefaultSplitterAlgorithm: splitter.DefaultAlgorithm,
255 SupportedSplitterAlgorithms: toAlgorithmInfo(splitter.SupportedAlgorithms(), neverDeprecated),
256 }
257
258 for k := range compression.ByName {
259 res.SupportedCompressionAlgorithms = append(res.SupportedCompressionAlgorithms, serverapi.AlgorithmInfo{
260 ID: string(k),
261 Deprecated: compression.IsDeprecated[k],
262 })
263 }
264
265 sortAlgorithms(res.SupportedHashAlgorithms)
266 sortAlgorithms(res.SupportedEncryptionAlgorithms)
267 sortAlgorithms(res.SupportedECCAlgorithms)
268 sortAlgorithms(res.SupportedCompressionAlgorithms)
269 sortAlgorithms(res.SupportedSplitterAlgorithms)
270
271 return res, nil
272}
273
274func neverDeprecated(string) bool {
275 return false

Callers

nothing calls this directly

Calls 6

SupportedAlgorithmsFunction · 0.92
SupportedAlgorithmsFunction · 0.92
SupportedAlgorithmsFunction · 0.92
SupportedAlgorithmsFunction · 0.92
toAlgorithmInfoFunction · 0.85
sortAlgorithmsFunction · 0.85

Tested by

no test coverage detected