C based plugins, clocks, locks, and configuration variables

From: Clifford Hammerschmidt <tanglebones(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: C based plugins, clocks, locks, and configuration variables
Date: 2016-11-03 22:04:17
Message-ID: CANvN6gxJ9itXZzPYBjNZeXQfc1F1fR+pYgWY=4P6a6HkeGcO8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

Apologies in advance if this isn't the right place to be posting this.

I've started work on a plugin in C (https://github.com/tanglebones/pg_tuid)
for generating generally monotonically ascending UUIDs (aka TUIDs), and
after googling around I couldn't find any guidence on a few things. (It's
hard to google for anything in the postgres C api as most results coming
back are for using postgres itself, not developing plugins for postgres.)

I'm looking for the idiomatic (and portable) way of:

1) getting microseconds (or nanoseconds) from UTC epoch in a plugin
2) getting an exclusive lock for a user plugin to serialize access to its
shared state (I'm assuming that plugins must be reentrant)
3) creating a configuration variable for a plugin and accessing its values
in the plugin. (e.g. `set plugin.configuration_variable=1` or somesuch)

Thanks,

--
Clifford Hammerschmidt, P.Eng.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-11-03 22:23:18 Re: Improving RLS planning
Previous Message Artur Zakirov 2016-11-03 19:57:51 Re: [PATCH] Generic type subscription