From: | Craig Ringer <craig(dot)ringer(at)2ndquadrant(dot)com> |
---|---|
To: | Clifford Hammerschmidt <tanglebones(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: C based plugins, clocks, locks, and configuration variables |
Date: | 2016-11-04 00:14:53 |
Message-ID: | CAMsr+YFEpmCAKgoiU=OhnwZXV3SmL-eRKShgDoDTpsaeBoJiKQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 4 Nov. 2016 06:05, "Clifford Hammerschmidt" <tanglebones(at)gmail(dot)com>
wrote:
>
> 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
GetCurrentIntegerTimestamp()
> 2) getting an exclusive lock for a user plugin to serialize access to its
shared state (I'm assuming that plugins must be reentrant)
Allocate an LWLock in your shared memory segment and use it to arbitrate
access. Multiple examples in contrib. Lwlock allocation infonin developer
docs.
> 3) creating a configuration variable for a plugin and accessing its
values in the plugin. (e.g. `set plugin.configuration_variable=1` or
somesuch)
DefineCustomIntegerVariable etc (I think, name not exactly right? On
phone). See guc.h .
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2016-11-04 00:16:57 | Re: Declarative partitioning - another take |
Previous Message | Haribabu Kommi | 2016-11-04 00:09:28 | Re: macaddr 64 bit (EUI-64) datatype support |