Lua API | Enterprise
Read views Lua API

Lua API

This topic describes the Lua API for working with read views.

box.read_view:open({opts})

Create a new read view.

Parameters:opts (table) – (optional) configurations options for a read view. For example, the name option specifies a read view name. If name is not specified, a read view name is set to unknown.
Returns:a created read view object
Return type:read_view_object

Example:

tarantool> read_view1 = box.read_view.open({name = 'read_view1'})
class read_view_object

An object that represents a read view.

read_view_object:info()

Get information about a read view such as a name, status, or ID. All the available fields are listed below in the object options.

Returns:information about a read view
Return type:table
read_view_object:close()

Close a read view. After the read view is closed, its status is set to closed. On an attempt to use it, an error is raised.

status

A read view status. The possible values are open and closed.

Return type:string
id

A unique numeric identifier of a read view.

Return type:number
name

A read view name. You can specify a read view name in the box.read_view.open() arguments.

Return type:string
is_system

Determine whether a read view is system. For example, system read views can be created to make a checkpoint or join a new replica.

Return type:boolean
timestamp

The fiber.clock() value at the moment of opening a read view.

Return type:number
vclock

The box.info.vclock value at the moment of opening a read view.

Return type:table
signature

The box.info.signature value at the moment of opening a read view.

Return type:number
space

Get access to database spaces included in a read view. You can use this field to query space data.

Return type:space object
Found what you were looking for?
Feedback