1// Copyright 2023 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package dcache
6
7import (
8	"./aconfig"
9	"./bresource"
10	"./cmem"
11)
12
13type Module struct {
14	cfg  *aconfig.Config
15	err  error
16	last any
17}
18
19//go:noinline
20func TD() {
21}
22
23func (m *Module) Configure(x string) error {
24	if m.err != nil {
25		return m.err
26	}
27	res := cmem.NewResource(m.cfg)
28	m.last = res
29
30	return nil
31}
32
33func (m *Module) Blurb(x string, e error) bool {
34	res, ok := m.last.(*bresource.Resource[*int])
35	if !ok {
36		panic("bad")
37	}
38	return bresource.Should(res, e)
39}
40