MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / Delete

Method Delete

internal/store/postgresstore.go:339–360  ·  view source on GitHub ↗

Delete removes an auth file and the corresponding database record.

(ctx context.Context, id string)

Source from the content-addressed store, hash-verified

337
338// Delete removes an auth file and the corresponding database record.
339func (s *PostgresStore) Delete(ctx context.Context, id string) error {
340 id = strings.TrimSpace(id)
341 if id == "" {
342 return fmt.Errorf("postgres store: id is empty")
343 }
344 path, err := s.resolveDeletePath(id)
345 if err != nil {
346 return err
347 }
348
349 s.mu.Lock()
350 defer s.mu.Unlock()
351
352 if err = os.Remove(path); err != nil && !errors.Is(err, fs.ErrNotExist) {
353 return fmt.Errorf("postgres store: delete auth file: %w", err)
354 }
355 relID, err := s.relativeAuthID(path)
356 if err != nil {
357 return err
358 }
359 return s.deleteAuthRecord(ctx, relID)
360}
361
362// PersistAuthFiles stores the provided auth file changes in PostgreSQL.
363func (s *PostgresStore) PersistAuthFiles(ctx context.Context, _ string, paths ...string) error {

Callers

nothing calls this directly

Calls 4

resolveDeletePathMethod · 0.95
relativeAuthIDMethod · 0.95
deleteAuthRecordMethod · 0.95
RemoveMethod · 0.80

Tested by

no test coverage detected