A page's time budget is sent to the runtime, and a verb the runtime lacks is told by its code (issue 1966)
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
+2
-2
@@ -26,8 +26,8 @@ func (k KeptSource) Get(key string) (*Entry, bool, error) {
|
||||
}
|
||||
|
||||
// Page is the values after a key in one request (stdio.KeptState.Page), as FirstView prefers them to Get per key.
|
||||
func (k KeptSource) Page(after string, maxBytes int) ([]KeyedEntry, string, error) {
|
||||
p, err := k.State.Page(after, maxBytes)
|
||||
func (k KeptSource) Page(after string, maxBytes int, budget time.Duration) ([]KeyedEntry, string, error) {
|
||||
p, err := k.State.Page(after, maxBytes, budget)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
+3
-3
@@ -201,10 +201,10 @@ type KeyedEntry struct {
|
||||
}
|
||||
|
||||
// Pager is a Source that answers many values in one request: the values in key order after a key, as many as fit
|
||||
// maxBytes and at least one, and the key to ask after for the rest. FirstView uses it when its source has it, unless
|
||||
// maxBytes or the time budget and at least one, and the key to ask after for the rest. FirstView uses it when its source has it, unless
|
||||
// it answers errors.Is(err, errors.ErrUnsupported), when it reads per key.
|
||||
type Pager interface {
|
||||
Page(after string, maxBytes int) ([]KeyedEntry, string, error)
|
||||
Page(after string, maxBytes int, budget time.Duration) ([]KeyedEntry, string, error)
|
||||
}
|
||||
|
||||
// FirstView answers one page of state from its owner's source: the mark first, so no change after the revision it
|
||||
@@ -226,7 +226,7 @@ func FirstView(owner, state string, values, marks Source, after string, now time
|
||||
}
|
||||
}
|
||||
if p, ok := values.(Pager); ok {
|
||||
got, next, err := p.Page(after, PageBytes)
|
||||
got, next, err := p.Page(after, PageBytes, PageBudget)
|
||||
if err == nil {
|
||||
for _, e := range got {
|
||||
a.put(e.Key, e.Entry)
|
||||
|
||||
@@ -676,7 +676,7 @@ func (s *pagedSource) Get(k string) (*Entry, bool, error) {
|
||||
return s.mapSource.Get(k)
|
||||
}
|
||||
|
||||
func (s *pagedSource) Page(after string, _ int) ([]KeyedEntry, string, error) {
|
||||
func (s *pagedSource) Page(after string, _ int, _ time.Duration) ([]KeyedEntry, string, error) {
|
||||
if s.unsupported {
|
||||
return nil, "", errors.ErrUnsupported
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user