G sessions: the runner serves a bundle's put and get sessions and states put-sessions
A value over buscalls.ChunkBytes is put by mesh/objects.put-chunk (written into the module's store as each chunk is taken, sealed on the last, dropped at its bound or a disorder) and got by mesh/objects.get-chunk after a chunked answer, for a state's object and a sent object alike; the 8 MiB BundleObjectMost cap is gone with the stateobjects constant. Builds: design 47 G §518, §345, §457, §490, §620, §622, A-21, A-25 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -17,24 +17,11 @@ import (
|
||||
// bindings alone. It reads as this connection's account, which the bus lets read a sender's sent store only where the
|
||||
// grants part granted it (a bundle is held to what its runtime channel carries by the runtime call, not here), from the manifests' callers and consumers; a refusal says the store.
|
||||
func (c *Conn) SentGet(r buscalls.ObjectsSentGetRequest) (*buscalls.ObjectData, error) {
|
||||
ref := stateobjects.Ref{Store: r.Store, Object: r.Object, Size: r.Size, Digest: r.Digest, Form: stateobjects.FormVersion}
|
||||
if _, ok := stateobjects.ReadRef(stateobjects.Wrap(ref)); !ok {
|
||||
return nil, errors.New("a sent object is named by the reference's store, object, size and sha256, as the reply or event carried them")
|
||||
}
|
||||
if !strings.HasSuffix(r.Store, catalogue.BusNameSeparator+catalogue.SentObjectsLocal) {
|
||||
return nil, fmt.Errorf("%s is no sent store (a module's is `<module>%s%s`): only a sent object is read by its reference",
|
||||
r.Store, catalogue.BusNameSeparator, catalogue.SentObjectsLocal)
|
||||
}
|
||||
js, err := c.JetStream()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), StateTimeout)
|
||||
defer cancel()
|
||||
obs, err := js.ObjectStore(ctx, r.Store)
|
||||
obs, err := c.sentStore(ctx, r)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("the sent store %s cannot be read as %s: it is not on the bus, or the bus grants this account no "+
|
||||
"read of it (the manifests' callers and consumers are granted): %w", r.Store, c.cred.Module, err)
|
||||
return nil, err
|
||||
}
|
||||
info, err := obs.GetInfo(ctx, r.Object)
|
||||
if errors.Is(err, jetstream.ErrObjectNotFound) {
|
||||
@@ -49,3 +36,25 @@ func (c *Conn) SentGet(r buscalls.ObjectsSentGetRequest) (*buscalls.ObjectData,
|
||||
}
|
||||
return &buscalls.ObjectData{Info: objectInfoOf(info), Data: data}, nil
|
||||
}
|
||||
|
||||
// sentStore checks the reference r and opens the sender's sent store it names.
|
||||
func (c *Conn) sentStore(ctx context.Context, r buscalls.ObjectsSentGetRequest) (jetstream.ObjectStore, error) {
|
||||
ref := stateobjects.Ref{Store: r.Store, Object: r.Object, Size: r.Size, Digest: r.Digest, Form: stateobjects.FormVersion}
|
||||
if _, ok := stateobjects.ReadRef(stateobjects.Wrap(ref)); !ok {
|
||||
return nil, errors.New("a sent object is named by the reference's store, object, size and sha256, as the reply or event carried them")
|
||||
}
|
||||
if !strings.HasSuffix(r.Store, catalogue.BusNameSeparator+catalogue.SentObjectsLocal) {
|
||||
return nil, fmt.Errorf("%s is no sent store (a module's is `<module>%s%s`): only a sent object is read by its reference",
|
||||
r.Store, catalogue.BusNameSeparator, catalogue.SentObjectsLocal)
|
||||
}
|
||||
js, err := c.JetStream()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
obs, err := js.ObjectStore(ctx, r.Store)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("the sent store %s cannot be read as %s: it is not on the bus, or the bus grants this account no "+
|
||||
"read of it (the manifests' callers and consumers are granted): %w", r.Store, c.cred.Module, err)
|
||||
}
|
||||
return obs, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user