gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

instance.go (2280B)


      1 // GoToSocial
      2 // Copyright (C) GoToSocial Authors admin@gotosocial.org
      3 // SPDX-License-Identifier: AGPL-3.0-or-later
      4 //
      5 // This program is free software: you can redistribute it and/or modify
      6 // it under the terms of the GNU Affero General Public License as published by
      7 // the Free Software Foundation, either version 3 of the License, or
      8 // (at your option) any later version.
      9 //
     10 // This program is distributed in the hope that it will be useful,
     11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 // GNU Affero General Public License for more details.
     14 //
     15 // You should have received a copy of the GNU Affero General Public License
     16 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
     17 
     18 package db
     19 
     20 import (
     21 	"context"
     22 
     23 	"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
     24 )
     25 
     26 // Instance contains functions for instance-level actions (counting instance users etc.).
     27 type Instance interface {
     28 	// CountInstanceUsers returns the number of known accounts registered with the given domain.
     29 	CountInstanceUsers(ctx context.Context, domain string) (int, Error)
     30 
     31 	// CountInstanceStatuses returns the number of known statuses posted from the given domain.
     32 	CountInstanceStatuses(ctx context.Context, domain string) (int, Error)
     33 
     34 	// CountInstanceDomains returns the number of known instances known that the given domain federates with.
     35 	CountInstanceDomains(ctx context.Context, domain string) (int, Error)
     36 
     37 	// GetInstance returns the instance entry for the given domain, if it exists.
     38 	GetInstance(ctx context.Context, domain string) (*gtsmodel.Instance, Error)
     39 
     40 	// GetInstanceAccounts returns a slice of accounts from the given instance, arranged by ID.
     41 	GetInstanceAccounts(ctx context.Context, domain string, maxID string, limit int) ([]*gtsmodel.Account, Error)
     42 
     43 	// GetInstancePeers returns a slice of instances that the host instance knows about.
     44 	GetInstancePeers(ctx context.Context, includeSuspended bool) ([]*gtsmodel.Instance, Error)
     45 
     46 	// GetInstanceModeratorAddresses returns a slice of email addresses belonging to active
     47 	// (as in, not suspended) moderators + admins on this instance.
     48 	GetInstanceModeratorAddresses(ctx context.Context) ([]string, Error)
     49 }