Re: table api question

2019-08-24 Thread Edgar Pettijohn
On Sat, Aug 24, 2019 at 08:19:00AM +, gil...@poolp.org wrote:
> 24 ao??t 2019 02:59 "Edgar Pettijohn"  a ??crit:
> 
> > I am writing a table-lua, however the table_lua_update function doesn't 
> > appear to be called.
> > Here are relevant pieces of the code.
> > 
> > The lookup function works. However, it would be more ideal to have the 
> > update() called early
> > to fill in the tables for the other functions. As is the lookup() has to do 
> > the work of both.
> > 
> > Any help is appreciated.
> > 
> 
> update is called when you issue an `smtpctl table update ` command.

Makes sense. However, the smtpctl manual says its for tables using the "file" 
backend.

> 
> On a side note, I had this discussion with someone a few days ago but can't 
> remember
> who, so if it was you and you already know, disregard:
>
> I have a plan for the next two releases to switch the implementation of 
> tables to an
> API similar to that of filters, so we can have tables become scripts that 
> read lines
> from stdin, write answers to stdout, be written in any language, etc..
> 

Not me but sounds interesting.
 
> Not discouraging you from writing something using the current API, it is not 
> so much
> work anyways, but just letting you know that in a relatively short term your 
> code is
> going to need a rewrite.

I was using table-passwd as a bit of a go by. Armed with this new knowledge. I 
see that 
table_passwd_update is called from main.  I think that is what I need to do.

Thanks,

Edgar



Re: table api question

2019-08-24 Thread gilles
24 août 2019 02:59 "Edgar Pettijohn"  a écrit:

> I am writing a table-lua, however the table_lua_update function doesn't 
> appear to be called.
> Here are relevant pieces of the code.
> 
> The lookup function works. However, it would be more ideal to have the 
> update() called early
> to fill in the tables for the other functions. As is the lookup() has to do 
> the work of both.
> 
> Any help is appreciated.
> 

update is called when you issue an `smtpctl table update ` command.

On a side note, I had this discussion with someone a few days ago but can't 
remember
who, so if it was you and you already know, disregard:

I have a plan for the next two releases to switch the implementation of tables 
to an
API similar to that of filters, so we can have tables become scripts that read 
lines
from stdin, write answers to stdout, be written in any language, etc..

Not discouraging you from writing something using the current API, it is not so 
much
work anyways, but just letting you know that in a relatively short term your 
code is
going to need a rewrite.