!
Hubzilla Support Forum!
Hubzilla DevelopmentI'm considering using the sub_realm functionality in my deployment hopefully keeping the load on the core directory servers to a minimum. Has anyone used it? Problems? Advice?
Looking through the code for sub_realms and noticed a few things: (NOTE: I was looking in dev - mostly in include/* - I know some stuff in dev has moved into Zotlabs/Lib - and some of these decisions may already have been made and dealt with - if so, feel free to just say, "Yup, dealt with it") and ignore.
1) Most db queries involving subrealms use
like '%realm%'
in the where clause. Since the subrealm feature is designed as a hierarchy, shouldn't that be
like 'realm%'
? or even better, standardize the delimeter and include the delimiter in the search string (eg.,
site_realm = 'realm' or site_realm like 'realm:%'
) ?
2) In
sync_directories()
(include/dir_fns.php), why is there a separate search if the directory realm set in the DB == DIRECTORY_REALM constant from boot.php? In the hierarchy, should it not sync all peers and subordinates?
3) To answer the @FIXME in dir_fns
@FIXME What to do if we're in a different realm?
-- It seems that if the DIRECTORY_FALLBACK_MASTER is not a PEER in the current realm, we need to at least check that we share some level of taxonomy within the hierarchy. For example,
RED_GLOBAL:sub1:subsub1
could use a
RED_GLOBAL
any directory server in the
RED_GLOBAL
realm or in the
RED_GLOBAL:sub1
or in the
RED_GLOBAL:sub1:subsub1
realm. But it should not use one in the
RED_GLOBAL:sub2
or
RED_GLOBAL:sub1:subsub2
realms. So, before the site_store_lowlevel, it seems we should query the DIRECTORY_FALLBACK_MASTER and find out it's realm. A big ole' error in the logs is probably the best bet, and perhaps a big red message at the top of the administrator's feed?
4) A similar hierarchy check answers the
@TODO: check if we're the same directory realm, which would mean we are allowed to see it
of include/zot.php --- though I'm a little confused by this note - if either is in "standalone" mode, isn't that the definitive setting for "off the grid" ("off grid" to me means don't communicate with ANYONE)? Removing
RED_GLOBAL
from the head of the realm should take a server out of the public grid and put them in a private grid (which I THINK would be the case if we changed the
like
clauses as indicated above.
5)
strpos($arr['site']['realm'],$realm)===false
needs to be reworked to mirror the
like
clauses if that's the way we go. My vote would be to make it
strpos($arr['site']['realm'],$realm)!==0
Looks like that covers most of the issues I can see/think of in my investigation. I'm sure there are changes based on those things that will need to be rolled into the realm related pieces that have been moved to Zotlabs/*.
As usual - my brain runs in a million directions - and these are as much just notes for myself and for discussion by those with a heckuvalot more knowledge than me in order to set me straight - not in any way a "we need to do it this way." Neither are they a "someone needs to do something about this" - but more of a "hey, I'm thinking of doing something about this and this is what I'm thinking of doing - but I don't want to break stuff or waste my time." (IF/WHEN I'll ever get around to it is a whole 'nother issue.)