-- What a friend may read, and how much: a library is shared with friends only when an admin says so; the limits -- are per friend; the log keeps the requests friends made (7 days, see internal/federation). ALTER TABLE libraries ADD COLUMN shared INTEGER NOT NULL DEFAULT 0; ALTER TABLE federation_settings ADD COLUMN max_streams INTEGER NOT NULL DEFAULT 3; -- parallel streams for one friend ALTER TABLE federation_settings ADD COLUMN max_kib_per_sec INTEGER NOT NULL DEFAULT 4096; -- 0 = no limit CREATE TABLE federation_requests ( id INTEGER PRIMARY KEY, friend_id INTEGER NOT NULL REFERENCES federation_friends(id) ON DELETE CASCADE, at INTEGER NOT NULL, -- unix seconds route TEXT NOT NULL, -- the route pattern, never the query status INTEGER NOT NULL, bytes INTEGER NOT NULL ); CREATE INDEX idx_federation_requests_at ON federation_requests(at);