package merkledag import ( "context" ld "gitlab.dms3.io/dms3/go-ld-format" ) // SessionMaker is an object that can generate a new fetching session. type SessionMaker interface { Session(context.Context) ld.NodeGetter } // NewSession returns a session backed NodeGetter if the given NodeGetter // implements SessionMaker. func NewSession(ctx context.Context, g ld.NodeGetter) ld.NodeGetter { if sm, ok := g.(SessionMaker); ok { return sm.Session(ctx) } return g }