Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
chore: remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann committed Jul 6, 2023
1 parent fd6e343 commit e56df8a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 257 deletions.
194 changes: 0 additions & 194 deletions lib/block_fetchers.go

This file was deleted.

63 changes: 0 additions & 63 deletions lib/graph_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,6 @@ func WithBlockstore(bs blockstore.Blockstore) GraphGatewayOption {

type GraphGatewayOption func(gwOptions *gwOptions) error

type Notifier interface {
NotifyNewBlocks(ctx context.Context, blocks ...blocks.Block) error
}

// notifiersForRootCid is used for reducing lock contention by only notifying
// exchanges related to the same content root CID
type notifiersForRootCid struct {
lk sync.RWMutex
deleted int8
notifiers []Notifier
}

type GraphGateway struct {
fetcher CarFetcher
blockFetcher exchange.Fetcher
Expand Down Expand Up @@ -272,57 +260,6 @@ func registerGraphGatewayMetrics() *GraphGatewayMetrics {
}
}

func (api *GraphGateway) getRootOfPath(path string) string {
pth, err := ipfspath.ParsePath(path)
if err != nil {
return path
}
if pth.IsJustAKey() {
return pth.Segments()[0]
} else {
return pth.Segments()[1]
}
}

type fileCloseWrapper struct {
files.File
closeFn func()
}

func (w *fileCloseWrapper) Close() error {
w.closeFn()
return w.File.Close()
}

type dirCloseWrapper struct {
files.Directory
closeFn func()
}

func (w *dirCloseWrapper) Close() error {
w.closeFn()
return w.Directory.Close()
}

func wrapNodeWithClose[T files.Node](node T, closeFn func()) (T, error) {
var genericNode files.Node = node
switch n := genericNode.(type) {
case *files.Symlink:
closeFn()
return node, nil
case files.File:
var f files.File = &fileCloseWrapper{n, closeFn}
return f.(T), nil
case files.Directory:
var d files.Directory = &dirCloseWrapper{n, closeFn}
return d.(T), nil
default:
closeFn()
var zeroType T
return zeroType, fmt.Errorf("unsupported node type")
}
}

func (api *GraphGateway) fetchCAR(ctx context.Context, path gateway.ImmutablePath, params gateway.CarParams, cb DataCallback) error {
escapedPath := url.PathEscape(path.String()[1:])
paramsBuilder := strings.Builder{}
Expand Down

0 comments on commit e56df8a

Please sign in to comment.