1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
package bidder
import (
"fmt"
"log"
"os"
"kesim.org/seal"
)
type auction struct {
description *seal.Description
bidder seal.Bidder
log func(string, ...any)
verbose func(string, ...any)
debug func(string, ...any)
}
func nullf(string, ...any) {}
func NewAuction(description *seal.Description, options ...Option) (a *auction, e error) {
if description.BitLength > 63 {
return nil, fmt.Errorf("Invalid BitLength in description: %d", description.BitLength)
}
logger := log.New(os.Stdout, "[seal::client] ", log.LstdFlags)
a = &auction{
description: description,
log: logger.Printf,
verbose: nullf,
debug: nullf,
}
for _, opt := range options {
opt(a)
}
return a, nil
}
func (a *auction) Join(bidder seal.Bidder) {
a.bidder = bidder
}
// Received is called by the consumer whenever a message came in for the auction via the dashboard
// or other means of communication.
func (a *auction) Received(msg []byte) error {
return fmt.Errorf("Auction.Received not implemented")
}
|