yeti-pg-ext is a part of project Yeti
# apt install wget gnupg
# echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list
# wget -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg
# echo "deb [arch=amd64] https://deb.yeti-switch.org/debian/1.13 bookworm main" > /etc/apt/sources.list.d/yeti.list
# wget http://deb.yeti-switch.org/yeti.gpg -O /etc/apt/trusted.gpg.d/deb.yeti-switch.org.asc
# apt update
# apt install postgresql-16-yeti
$ git clone https://github.com/yeti-switch/yeti-pg-ext.git
$ cd yeti-pg-ext
# echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" > /etc/apt/sources.list.d/pgdg.list
# wget -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg
# apt update
# apt build-dep .
$ make deb
# brew install postgresql nanomsg
$ git clone https://github.com/yeti-switch/yeti-pg-ext.git
$ cd yeti-pg-ext
$ make
# make install
yeti=# CREATE SCHEMA yeti_ext;
CREATE SCHEMA
yeti=# CREATE EXTENSION yeti WITH SCHEMA yeti_ext;
CREATE EXTENSION
yeti=# \dx yeti
List of installed extensions
Name | Version | Schema | Description
------+---------+----------+-----------------------------------
yeti | 1.3.9 | yeti_ext | helper functions for YETI project
(1 row)
yeti=# \df yeti_ext.*
List of functions
Schema | Name | Result data type | Argument data types | Type
----------+-------------------------------+--------------------------------+-------------------------------------------------------------------------------------------------------+--------
yeti_ext | lnp_endpoints_cache_set | void | key text, response text, error boolean | func
yeti_ext | lnp_endpoints_set | void | endpoints text[] | func
yeti_ext | lnp_endpoints_show | SETOF yeti_ext.endpoints | | func
yeti_ext | lnp_resolve_cnam | json | database_id integer, data json | func
yeti_ext | lnp_resolve_tagged | yeti_ext.lnp_result | database_id integer, local_number text | func
yeti_ext | lnp_resolve_tagged_with_error | yeti_ext.lnp_result_with_error | database_id integer, local_number text | func
yeti_ext | lnp_set_rtt_timeout | void | timeout_msec integer | func
yeti_ext | lnp_set_timeout | void | timeout_msec integer | func
yeti_ext | rank_dns_srv | integer | weight integer | window
yeti_ext | regexp_replace_rand | text | text_in text, regexp_rule text, regexp_result text, keep_empty boolean DEFAULT false | func
yeti_ext | regexp_replace_rand | text[] | text_in text[], regexp_rule text, regexp_result text, keep_empty boolean DEFAULT false | func
yeti_ext | regexp_replace_rand | text | text_in text, regexp_rule text, regexp_result text, regexp_opt text, keep_empty boolean DEFAULT false | func
yeti_ext | replace_rand | text | text | func
yeti_ext | tag_action | integer[] | op integer, a integer[], b integer[] | func
yeti_ext | tag_compare | integer | a integer[], b integer[], match_mode smallint DEFAULT 0 | func
yeti_ext | tbf_rate_check | boolean | namespace_id integer, bucket_id bigint, rate real | func
(16 rows)
add extension to the shared_preload_libraries
to use tbf_rate_check() function (needs postgresql restart)
# grep yeti /etc/postgresql/16/main/postgresql.conf
shared_preload_libraries='yeti_pg_ext'
# pg_ctlcluster 16 main restart