|
@ -17,11 +17,11 @@ func (store *YdbStore) KvPut(ctx context.Context, key []byte, value []byte) (err |
|
|
return store.DB.Table().Do(ctx, func(ctx context.Context, s table.Session) (err error) { |
|
|
return store.DB.Table().Do(ctx, func(ctx context.Context, s table.Session) (err error) { |
|
|
stmt, err := s.Prepare(ctx, withPragma(store.getPrefix(ctx, dirStr), insertQuery)) |
|
|
stmt, err := s.Prepare(ctx, withPragma(store.getPrefix(ctx, dirStr), insertQuery)) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return fmt.Errorf("Prepare %s: %v", util.NewFullPath(dirStr, name).Name(), err) |
|
|
|
|
|
|
|
|
return fmt.Errorf("kv put prepare %s: %v", util.NewFullPath(dirStr, name).Name(), err) |
|
|
} |
|
|
} |
|
|
_, _, err = stmt.Execute(ctx, rwTX, fileMeta.queryParameters()) |
|
|
_, _, err = stmt.Execute(ctx, rwTX, fileMeta.queryParameters()) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return fmt.Errorf("kv put %s: %v", util.NewFullPath(dirStr, name).Name(), err) |
|
|
|
|
|
|
|
|
return fmt.Errorf("kv put execute %s: %v", util.NewFullPath(dirStr, name).Name(), err) |
|
|
} |
|
|
} |
|
|
return nil |
|
|
return nil |
|
|
}) |
|
|
}) |
|
@ -33,13 +33,13 @@ func (store *YdbStore) KvGet(ctx context.Context, key []byte) (value []byte, err |
|
|
err = store.DB.Table().Do(ctx, func(ctx context.Context, s table.Session) error { |
|
|
err = store.DB.Table().Do(ctx, func(ctx context.Context, s table.Session) error { |
|
|
stmt, err := s.Prepare(ctx, withPragma(store.getPrefix(ctx, dirStr), findQuery)) |
|
|
stmt, err := s.Prepare(ctx, withPragma(store.getPrefix(ctx, dirStr), findQuery)) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return fmt.Errorf("Prepare %s: %v", util.NewFullPath(dirStr, name), err) |
|
|
|
|
|
|
|
|
return fmt.Errorf("kv get prepare %s: %v", util.NewFullPath(dirStr, name), err) |
|
|
} |
|
|
} |
|
|
_, res, err := stmt.Execute(ctx, roTX, table.NewQueryParameters( |
|
|
_, res, err := stmt.Execute(ctx, roTX, table.NewQueryParameters( |
|
|
table.ValueParam("$dir_hash", types.Int64Value(dirHash)), |
|
|
table.ValueParam("$dir_hash", types.Int64Value(dirHash)), |
|
|
table.ValueParam("$name", types.UTF8Value(name)))) |
|
|
table.ValueParam("$name", types.UTF8Value(name)))) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return fmt.Errorf("kv get %s: %v", util.NewFullPath(dirStr, name).Name(), err) |
|
|
|
|
|
|
|
|
return fmt.Errorf("kv get execute %s: %v", util.NewFullPath(dirStr, name).Name(), err) |
|
|
} |
|
|
} |
|
|
defer func() { _ = res.Close() }() |
|
|
defer func() { _ = res.Close() }() |
|
|
for res.NextRow() { |
|
|
for res.NextRow() { |
|
|