• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tarantool / tarantool / 15273888343

27 May 2025 11:19AM UTC coverage: 87.528% (+0.05%) from 87.479%
15273888343

push

github

locker
box: add format_object field to spaces

Add a `format_object` field  to spaces that returns the associated
`box.tuple.format` object. This enables users to access tuple format
metadata and invoke methods like `validate()` without creating or
inserting a tuple.

The `format_object` field is not available for spaces accessed over
net.box, because creating it would trigger C-level validation of
field types and collation IDs on the client. If the format references
a field type unknown to the client or a collation ID that isn’t
present locally, an error will be raised during schema installation.

Editing tests:

The `format_object` method  creates references to `tuple_format` for
space object via `tuple_format_ref`. These references can be held by
spaces remaining in memory (for example, in the global space table),
especially if other tests create spaces.

In `gh_4693_formats_for_standalone_tuples_test` added an initial call to
`collectgarbage()` to clear the tuple format pool before creating new
`tuple_formats`.

In `net.box_reuse_tuple_formats_gh-6217.test` increased the
`ERRINJ_TUPLE_FORMAT_COUNT` limit from 100 to 113. Sine initially more
than 100 tuple formats are created in the session due to the links help
by the `format_object` method. Increasing the limit allows you to take
into account existing formats.

In `war_off/alter.test` added explicit deletion of references, which
allows the Lua garbage collector to free object of spaces and their
format_object.

Closes #9979

@TarantoolBot document
Title: Add format_object field to spaces
Since: 3.5

The `format_object` field returns the `box.tuple.format` object associated
with the space’s format. It provides the same API as `box.tuple.format`,
including `:validate()` and other.

Example:
```lua
space = box.schema.space.create('test', {
    format = {
        {name = 'id', type = 'unsigned'},
        {name = 'name', type = 'string'}
    }
})

space.format_object:validate({123, 'example'})
```

70467 of 124187 branches covered (56.74%)

11 of 11 new or added lines in 2 files covered. (100.0%)

341 existing lines in 9 files now uncovered.

103626 of 118392 relevant lines covered (87.53%)

2772820.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.22
/src/lua/fiber.c


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc