Documentation
¶
Index ¶
- type Fake
- func (f *Fake) Ack(_ context.Context, stream, group string, entries ...string) (int64, error)
- func (f *Fake) AddAll(_ context.Context, streams []string, fields map[string]string, ...) error
- func (f *Fake) AddOnce(_ context.Context, key, record string, keep time.Duration, streams []string, ...) (string, bool, error)
- func (f *Fake) Advance(d time.Duration)
- func (f *Fake) BlockRead(ctx context.Context, stream, after string, block time.Duration, count int) ([]bus.Entry, error)
- func (f *Fake) Claim(_ context.Context, stream, group, _ string, minIdle time.Duration, count int) ([]bus.Entry, error)
- func (f *Fake) EnsureGroup(_ context.Context, stream, group string) error
- func (f *Fake) Forward(_ context.Context, key, state string, ids ...string) ([]string, error)
- func (f *Fake) Get(_ context.Context, stream string, entries []string) ([]bus.Entry, error)
- func (f *Fake) Group(_ context.Context, stream, group string) (string, bool, error)
- func (f *Fake) Len(stream string) int
- func (f *Fake) Marks(_ context.Context, keys ...string) ([]map[string]string, error)
- func (f *Fake) Members(context.Context) ([]string, []string, time.Time, error)
- func (f *Fake) Pending(_ context.Context, stream, group string, count int) ([]string, error)
- func (f *Fake) Range(_ context.Context, stream, from, to string, count int) ([]bus.Entry, error)
- func (f *Fake) Read(_ context.Context, stream, group, _ string, _ time.Duration, count int) ([]bus.Entry, error)
- func (f *Fake) Release(_ context.Context, stream, group string, entries ...string) error
- func (f *Fake) Roster(context.Context) ([]string, time.Time, error)
- func (f *Fake) Sent(_ context.Context, key string) (string, bool, error)
- func (f *Fake) Tail(ctx context.Context, stream string) (string, bool, error)
- func (f *Fake) Unmark(_ context.Context, key string, fields ...string) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fake ¶
type Fake struct {
// Friends is which names of the roster are friends (the set `friends`);
// the rest are machines. A test sets it before the first send.
Friends []string
// Fail, when set, is the error every command answers: a store that is down.
Fail error
// Lose, when set, is the answer of the next write of a message (AddAll
// with streams, or AddOnce that writes): it commits, then its response is
// lost. It is cleared by the write it answers.
Lose error
// FailForward, when set, is the answer of every receipt stamp (Forward):
// a store that refuses the receipts hash alone.
FailForward error
// Trips counts the commands sent.
Trips int
// Sleep, when set, is what a BlockRead that finds nothing waits its block
// out on: the test's clock, never real time.
Sleep func(d time.Duration)
// contains filtered or unexported fields
}
Fake is the Store in memory: the streams, the groups with their pending entries, the roster and a clock that moves one second per Roster call, so no test reads the real clock. It refuses what Redis refuses (a read of a group that is not there) and keeps the same idle-free claim order. A test makes its own with NewFake; nothing is shared.
func (*Fake) BlockRead ¶
func (f *Fake) BlockRead(ctx context.Context, stream, after string, block time.Duration, count int) ([]bus.Entry, error)
BlockRead is the entries past the cursor, up to count, touching no group, so what it hands out stays a later recv's; a block that finds none waits its duration out on Sleep (SPEC-BUS.md, the verbs: wait).
func (*Fake) EnsureGroup ¶
Click to show internal directories.
Click to hide internal directories.