Do not store all payload in memory #115
5 changed files with 18 additions and 15 deletions
|
@ -84,7 +84,7 @@ func (g *Generator) fillBuffer() {
|
|||
}
|
||||
g.buf = b.Bytes()
|
||||
default:
|
||||
rand.Read(g.buf) // Per docs, err is always nil here
|
||||
g.rand.Read(g.buf) // Per docs, err is always nil here
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ func storageEngineOptionsFromConfig(c *config.Config, debug bool, l Limiter) ([]
|
|||
|
||||
var shOpts [][]shard.Option
|
||||
|
||||
engineconfig.IterateShards(c, false, func(sc *shardconfig.Config) error {
|
||||
err := engineconfig.IterateShards(c, false, func(sc *shardconfig.Config) error {
|
||||
opts := []shard.Option{
|
||||
shard.WithRefillMetabase(sc.RefillMetabase()),
|
||||
shard.WithMode(sc.Mode()),
|
||||
|
@ -375,7 +375,9 @@ func storageEngineOptionsFromConfig(c *config.Config, debug bool, l Limiter) ([]
|
|||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("iterate shards: %w", err)
|
||||
}
|
||||
return ngOpts, shOpts, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -309,10 +309,9 @@ func (c *Client) PutContainer(params map[string]string) PutContainerResponse {
|
|||
}
|
||||
|
||||
start := time.Now()
|
||||
var prm client.PrmContainerPut
|
||||
prm.SetContainer(cnr)
|
||||
|
||||
res, err := c.cli.ContainerPut(c.vu.Context(), prm)
|
||||
res, err := c.cli.ContainerPut(c.vu.Context(), client.PrmContainerPut{
|
||||
Container: &cnr,
|
||||
})
|
||||
if err != nil {
|
||||
return c.putCnrErrorResponse(err)
|
||||
}
|
||||
|
@ -500,10 +499,9 @@ func (x *waitParams) setDefaults() {
|
|||
|
||||
func (c *Client) waitForContainerPresence(ctx context.Context, cnrID cid.ID, wp *waitParams) error {
|
||||
return waitFor(ctx, wp, func(ctx context.Context) bool {
|
||||
var prm client.PrmContainerGet
|
||||
prm.SetContainer(cnrID)
|
||||
|
||||
_, err := c.cli.ContainerGet(ctx, prm)
|
||||
_, err := c.cli.ContainerGet(ctx, client.PrmContainerGet{
|
||||
ContainerID: &cnrID,
|
||||
})
|
||||
return err == nil
|
||||
})
|
||||
}
|
||||
|
|
|
@ -89,9 +89,9 @@ func (n *Native) Connect(endpoint, hexPrivateKey string, dialTimeout, streamTime
|
|||
|
||||
// generate session token
|
||||
exp := uint64(math.MaxUint64)
|
||||
var prmSessionCreate client.PrmSessionCreate
|
||||
prmSessionCreate.SetExp(exp)
|
||||
sessionResp, err := cli.SessionCreate(n.vu.Context(), prmSessionCreate)
|
||||
sessionResp, err := cli.SessionCreate(n.vu.Context(), client.PrmSessionCreate{
|
||||
Expiration: exp,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("dial endpoint: %s %w", endpoint, err)
|
||||
}
|
||||
|
|
|
@ -151,7 +151,10 @@ func (s *Local) Connect(configFile string, configDir string, params map[string]s
|
|||
}
|
||||
|
||||
l := layer.NewLayer(zap.L(), &frostfs{rc}, cfg)
|
||||
l.Initialize(s.l.VU().Context(), nopEventListener{})
|
||||
err = l.Initialize(s.l.VU().Context(), nopEventListener{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("initialize: %w", err)
|
||||
}
|
||||
|
||||
return &Client{
|
||||
vu: s.l.VU(),
|
||||
|
|
Loading…
Reference in a new issue