README

Berty go/pkg/bertymessenger

go.dev reference

Please, read the main README.md file first.

Usage

import "berty.tech/berty/v2/go/pkg/bertymessenger"

Get the code

git clone https://github.com/berty/berty
cd berty/go/pkg/bertymessenger

Documentation

Overview

    Package bertymessenger contains the top-level API that uses the Berty Protocol to implement the Berty Messenger specific logic.

    Index

    Constants

    View Source
    const (
    	StateActive lifecycle.State = iota
    	StateInactive
    )

    Variables

    This section is empty.

    Functions

    func RestoreFromAccountExport

    func RestoreFromAccountExport(ctx context.Context, reader io.Reader, coreAPI ipfs_interface.CoreAPI, odb *bertyprotocol.BertyOrbitDB, localDBState *mt.LocalDatabaseState, logger *zap.Logger) error

    func TestingInfra

    func TestingInfra(ctx context.Context, t *testing.T, amount int, logger *zap.Logger) ([]messengertypes.MessengerServiceClient, []*bertyprotocol.TestingProtocol, func())

    Types

    type ColumnInfo

    type ColumnInfo struct {
    	ColumnID  string
    	Name      string
    	Type      string
    	NotNull   *string
    	DfltValue *string
    	PK        string
    }

    func (*ColumnInfo) Equals

    func (t *ColumnInfo) Equals(other *ColumnInfo) bool

    type Dispatcher

    type Dispatcher struct {
    	// contains filtered or unexported fields
    }

    func NewDispatcher

    func NewDispatcher() *Dispatcher

    func (*Dispatcher) Notify

    func (d *Dispatcher) Notify(typ messengertypes.StreamEvent_Notified_Type, title, body string, msg proto.Message) error

    func (*Dispatcher) Register

    func (d *Dispatcher) Register(n Notifiee) func()

    func (*Dispatcher) StreamEvent

    func (d *Dispatcher) StreamEvent(typ messengertypes.StreamEvent_Type, msg proto.Message, isNew bool) error

    func (*Dispatcher) Unregister

    func (d *Dispatcher) Unregister(n Notifiee)

    func (*Dispatcher) UnregisterAll

    func (d *Dispatcher) UnregisterAll()

    type Notifiee

    type Notifiee interface {
    	StreamEvent(*messengertypes.StreamEvent) error
    }

      Notifiee system inspired from ipfs

      type NotifieeBundle

      type NotifieeBundle struct {
      	StreamEventImpl func(c *messengertypes.StreamEvent) error
      }

      func (*NotifieeBundle) StreamEvent

      func (nb *NotifieeBundle) StreamEvent(c *messengertypes.StreamEvent) error

      type Opts

      type Opts struct {
      	EnableGroupMonitor  bool
      	Logger              *zap.Logger
      	DB                  *gorm.DB
      	NotificationManager notification.Manager
      	LifeCycleManager    *lifecycle.Manager
      	StateBackup         *mt.LocalDatabaseState
      	Ring                *zapring.Core
      }

      type SearchOptions

      type SearchOptions struct {
      	BeforeDate     int
      	AfterDate      int
      	Limit          int
      	RefCID         string
      	OldestToNewest bool
      }

      type Service

      type Service interface {
      	mt.MessengerServiceServer
      	Close()
      }

      func New

      type TestingAccount

      type TestingAccount struct {
      	// contains filtered or unexported fields
      }

      func Testing1To1ProcessWholeStream

      func Testing1To1ProcessWholeStream(t *testing.T) (context.Context, []*TestingAccount, *zap.Logger, func())

      func (*TestingAccount) Close

      func (a *TestingAccount) Close()

      func (*TestingAccount) DrainInitEvents

      func (a *TestingAccount) DrainInitEvents(t *testing.T)

      func (*TestingAccount) GetAccount

      func (a *TestingAccount) GetAccount() *messengertypes.Account

      func (*TestingAccount) GetAllContacts

      func (a *TestingAccount) GetAllContacts() map[string]*messengertypes.Contact

      func (*TestingAccount) GetAllConversations

      func (a *TestingAccount) GetAllConversations() map[string]*messengertypes.Conversation

      func (*TestingAccount) GetClient

      func (*TestingAccount) GetContact

      func (a *TestingAccount) GetContact(t *testing.T, pk string) *messengertypes.Contact

      func (*TestingAccount) GetConversation

      func (a *TestingAccount) GetConversation(t *testing.T, pk string) *messengertypes.Conversation

      func (*TestingAccount) GetInteraction

      func (a *TestingAccount) GetInteraction(t *testing.T, cid string) *messengertypes.Interaction

      func (*TestingAccount) GetMedia

      func (a *TestingAccount) GetMedia(t *testing.T, cid string) *messengertypes.Media

      func (*TestingAccount) GetStream

      func (*TestingAccount) NextEvent

      func (*TestingAccount) ProcessWholeStream

      func (a *TestingAccount) ProcessWholeStream(t *testing.T) func()

      func (*TestingAccount) SetName

      func (a *TestingAccount) SetName(t *testing.T, name string)

      func (*TestingAccount) SetNameAndDrainUpdate

      func (a *TestingAccount) SetNameAndDrainUpdate(t *testing.T, name string)

      func (*TestingAccount) TryNextEvent

      func (a *TestingAccount) TryNextEvent(t *testing.T, timeout time.Duration) *messengertypes.StreamEvent

      type TestingServiceOpts

      type TestingServiceOpts struct {
      	Logger *zap.Logger
      	Client bertyprotocol.Client
      	Index  int
      	Ring   *zapring.Core
      }