tarantool

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2023 License: GPL-3.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

xk6-tarantool

This is a k6 extension using the xk6 system.

❗ This is a proof of concept, isn't supported by the k6 team, and may break in the future. USE AT YOUR OWN RISK!

Build

To build a k6 binary with this extension, first ensure you have the prerequisites:

Then:

  1. Clone xk6:
git clone https://github.com/k6io/xk6.git
cd xk6
  1. Build the binary:
CGO_ENABLED=1 go run ./cmd/xk6/main.go build master \
  --with github.com/hackfeed/xk6-tarantool

Example

Make sure you configured a space in Tarantool console first:

box.schema.space.create("cars")
box.space.cars:format({
    {name = 'id', type = 'unsigned'},
    {name = 'model', type = 'string'}
})
box.space.cars:create_index('pk', {
    type = 'hash',
    parts = {'id'}
})

Test script:

import tarantool from "k6/x/tarantool";

const conn = tarantool.connect("localhost:3301");

export const setup = () => {
  tarantool.insert(conn, "cars", [1, "cadillac"]);
};

export default () => {
  console.log(tarantool.call(conn, "box.space.cars:select", [1]));
};

export const teardown = () => {
  tarantool.delete(conn, "cars", "pk", [1]);
};

Result output:

$ ./k6 run test.js 

          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: test.js
     output: -

  scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
           * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

INFO[0000] <3 OK [[1 cadillac]]>                         source=console

running (00m00.0s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs  00m00.0s/10m0s  1/1 iters, 1 per VU

     █ setup

     █ teardown

     data_received........: 0 B 0 B/s
     data_sent............: 0 B 0 B/s
     iteration_duration...: avg=1.46ms min=1.39ms med=1.48ms max=1.51ms p(90)=1.5ms p(95)=1.51ms
     iterations...........: 1   62.668421/s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tarantool

type Tarantool struct{}

Tarantool is the k6 Tarantool extension

func (Tarantool) Call

func (Tarantool) Call(conn *multi.ConnectionMulti, fnName string, args interface{}) (*tarantool.Response, error)

Call calls registered tarantool function

func (Tarantool) Call17

func (Tarantool) Call17(conn *multi.ConnectionMulti, fnName string, args interface{}) (*tarantool.Response, error)

Call17 calls registered tarantool function

func (Tarantool) CallAsyncNoReturn

func (Tarantool) CallAsyncNoReturn(conn *multi.ConnectionMulti, fnName string, args interface{})

func (Tarantool) Connect

func (Tarantool) Connect(addrs []string, opts tarantool.Opts) (*multi.ConnectionMulti, error)

Connect creates a new Tarantool connection

func (Tarantool) Delete

func (Tarantool) Delete(conn *multi.ConnectionMulti, space, index, key interface{}) (*tarantool.Response, error)

Delete performs deletion of a tuple by key

func (Tarantool) Eval

func (Tarantool) Eval(conn *multi.ConnectionMulti, expr string, args interface{}) (*tarantool.Response, error)

Eval passes lua expression for evaluation

func (Tarantool) Insert

func (Tarantool) Insert(conn *multi.ConnectionMulti, space, data interface{}) (*tarantool.Response, error)

Insert performs insertion to box.space

func (Tarantool) Replace

func (Tarantool) Replace(conn *multi.ConnectionMulti, space, data interface{}) (*tarantool.Response, error)

Replace performs "insert or replace" action to box.space

func (Tarantool) ResolveCallFutures

func (Tarantool) ResolveCallFutures()

func (Tarantool) Select

func (Tarantool) Select(conn *multi.ConnectionMulti, space, index interface{}, offset, limit, iterator uint32, key interface{}) (*tarantool.Response, error)

Select performs select to box.space

func (Tarantool) Update

func (Tarantool) Update(conn *multi.ConnectionMulti, space, index, key, ops interface{}) (*tarantool.Response, error)

Update performs update of a tuple by key

func (Tarantool) Upsert

func (Tarantool) Upsert(conn *multi.ConnectionMulti, space, tuple, ops interface{}) (*tarantool.Response, error)

Upsert performs "update or insert" action of a tuple by key

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址