Documentation ¶
Index ¶
- Constants
- Variables
- func CleanRaftStorage(myID *types.PttID, rs *RaftStorage, isLocked bool) error
- func InitMe(dataDir string) error
- func MasterOplogsToOplogs(typedLogs []*MasterOplog) []*pkgservice.BaseOplog
- func MeOplogsToOplogs(typedLogs []*MeOplog) []*pkgservice.BaseOplog
- func ProtocolJoinBoardLogs() error
- func ProtocolJoinFriendLogs() error
- func TeardownMe()
- type ApproveJoinFriend
- type ApproveJoinMe
- type Backend
- func (b *Backend) APIs() []rpc.API
- func (b *Backend) ForceRemoveNode(nodeIDStr string) (bool, error)
- func (b *Backend) ForceSyncMeMerkle(entityIDBytes []byte) (bool, error)
- func (b *Backend) Get() (*BackendMyInfo, error)
- func (b *Backend) GetBoard(entityIDBytes []byte) (*content.BackendGetBoard, error)
- func (b *Backend) GetBoardRequests(entityIDBytes []byte) ([]*pkgservice.BackendJoinRequest, error)
- func (b *Backend) GetFriendRequests(entityIDBytes []byte) ([]*pkgservice.BackendJoinRequest, error)
- func (b *Backend) GetJoinKeys(entityIDBytes []byte) ([]*pkgservice.KeyInfo, error)
- func (b *Backend) GetMeList() ([]*BackendMyInfo, error)
- func (b *Backend) GetMeOplogList(entityIDBytes []byte, logIDBytes []byte, limit int, listOrder pttdb.ListOrder) ([]*MeOplog, error)
- func (b *Backend) GetMeOplogMerkleNodeList(entityIDBytes []byte, level pkgservice.MerkleTreeLevel, startKey []byte, ...) ([]*pkgservice.BackendMerkleNode, error)
- func (b *Backend) GetMeRequests(entityIDBytes []byte) ([]*pkgservice.BackendJoinRequest, error)
- func (b *Backend) GetMyIDStr() (string, error)
- func (b *Backend) GetMyMasterOplogList(entityIDBytes []byte, logIDBytes []byte, limit int, listOrder pttdb.ListOrder) ([]*MasterOplog, error)
- func (b *Backend) GetMyNodes(entityIDBytes []byte) ([]*MyNode, error)
- func (b *Backend) GetMyProfile(entityIDBytes []byte) (*account.Profile, error)
- func (b *Backend) GetPendingMeOplogInternalList(entityIDBytes []byte, logIDBytes []byte, limit int, listOrder pttdb.ListOrder) ([]*MeOplog, error)
- func (b *Backend) GetPendingMeOplogMasterList(entityIDBytes []byte, logIDBytes []byte, limit int, listOrder pttdb.ListOrder) ([]*MeOplog, error)
- func (b *Backend) GetRaftStatus(entityIDBytes []byte) (*RaftStatus, error)
- func (b *Backend) GetRawMe(entityIDBytes []byte) (*MyInfo, error)
- func (b *Backend) GetTotalWeight(entityIDBytes []byte) (uint32, error)
- func (b *Backend) JoinBoard(friendURL []byte) (*pkgservice.BackendJoinRequest, error)
- func (b *Backend) JoinFriend(friendURL []byte) (*pkgservice.BackendJoinRequest, error)
- func (b *Backend) JoinMe(meURL []byte, myKeyBytes []byte) (*pkgservice.BackendJoinRequest, error)
- func (b *Backend) Name() string
- func (b *Backend) RefreshMyNodeSignKey() (*pkgservice.KeyInfo, error)
- func (b *Backend) RefreshMySignKey() (*pkgservice.KeyInfo, error)
- func (b *Backend) RemoveBoardRequests(entityIDBytes []byte, hash []byte) (bool, error)
- func (b *Backend) RemoveFriendRequests(entityIDBytes []byte, hash []byte) (bool, error)
- func (b *Backend) RemoveMeRequests(entityIDBytes []byte, hash []byte) (bool, error)
- func (b *Backend) RemoveNode(nodeIDStr string) (bool, error)
- func (b *Backend) RequestRaftLead() (bool, error)
- func (b *Backend) Revoke(myKey []byte) (bool, error)
- func (b *Backend) SetMyImage(imgStr string) (*account.UserImg, error)
- func (b *Backend) SetMyName(name []byte) (*account.UserName, error)
- func (b *Backend) SetMyNameCard(nameCard []byte) (*account.NameCard, error)
- func (b *Backend) SetMyNodeName(nodeIDBytes []byte, name []byte) (*MyNode, error)
- func (b *Backend) ShowMeURL() (*pkgservice.BackendJoinURL, error)
- func (b *Backend) ShowMyMasterKey() ([]byte, error)
- func (b *Backend) ShowMyNodeKey() ([]byte, error)
- func (b *Backend) ShowMyNodeSignKey() (*pkgservice.KeyInfo, error)
- func (b *Backend) ShowMySignKey() (*pkgservice.KeyInfo, error)
- func (b *Backend) ShowURL() (*pkgservice.BackendJoinURL, error)
- func (b *Backend) Start() error
- func (b *Backend) Stop() error
- func (b *Backend) ValidateMyMasterKey(keyBytes []byte) (bool, error)
- func (b *Backend) ValidateMyNodeKey(keyBytes []byte) (bool, error)
- type BackendMyInfo
- type Config
- func (c *Config) DeleteKey() error
- func (c *Config) GetDataPrivateKeyByID(myID *types.PttID) (*ecdsa.PrivateKey, error)
- func (c *Config) LoadKey(filename string) (*ecdsa.PrivateKey, *types.PttID, error)
- func (c *Config) ResolvePath(path string) string
- func (c *Config) ResolvePrivateKeyWithIDPath(myID *types.PttID) (string, error)
- func (c *Config) RevokeKey() error
- func (c *Config) RevokeMyKey(myID *types.PttID) error
- func (c *Config) SaveKey(filename string, key *ecdsa.PrivateKey, postfix string) error
- func (c *Config) SetMyKey(hex string, file string, postfix string, isSave bool) error
- type InitMeInfo
- type InitMeInfoAck
- type InitMeInfoSync
- type InternalSyncBoardAck
- type InternalSyncFriendAck
- type JoinBoardEvent
- type JoinFriendEvent
- type JoinMeEvent
- type JoinMeRequest
- type MasterOpAddMaster
- type MasterOpRevokeMaster
- type MasterOplog
- type MeOpCreateMe
- type MeOpDeleteMe
- type MeOpEntity
- type MeOpMigrateMe
- type MeOpSetNodeName
- type MeOplog
- type MyInfo
- func (m *MyInfo) CreateEntityOpType(entity pkgservice.Entity) (pkgservice.OpType, error)
- func (m *MyInfo) CreateEntityOplog(entity pkgservice.Entity) error
- func (m *MyInfo) CreateJoinEntityOplog(entity pkgservice.Entity) error
- func (m *MyInfo) CreateNodeSignKeyInfo() error
- func (m *MyInfo) CreateSignKeyInfo() error
- func (m *MyInfo) GetBoard() pkgservice.Entity
- func (m *MyInfo) GetJoinRequest(hash *common.Address) (*pkgservice.JoinRequest, error)
- func (m *MyInfo) GetLenNodes() int
- func (m *MyInfo) GetMasterKey() *ecdsa.PrivateKey
- func (m *MyInfo) GetMyKey() *ecdsa.PrivateKey
- func (m *MyInfo) GetNodeKey() *ecdsa.PrivateKey
- func (m *MyInfo) GetNodeSignID() *types.PttID
- func (m *MyInfo) GetProfile() pkgservice.Entity
- func (m *MyInfo) GetUpdateTS() types.Timestamp
- func (m *MyInfo) GetUserNodeID(id *types.PttID) (*discover.NodeID, error)
- func (m *MyInfo) GetValidateKey() *types.PttID
- func (m *MyInfo) HandleApproveJoin(dataBytes []byte, hash *common.Address, joinRequest *pkgservice.JoinRequest, ...) error
- func (m *MyInfo) Init(thePtt pkgservice.Ptt, service pkgservice.Service, ...) error
- func (m *MyInfo) InitPM(ptt pkgservice.MyPtt, service pkgservice.Service) error
- func (m *MyInfo) InternalSign(oplog *pkgservice.BaseOplog) error
- func (m *MyInfo) IsValidInternalOplog(signInfos []*pkgservice.SignInfo) (*types.PttID, uint32, bool)
- func (m *MyInfo) JoinEntityOpType(entity pkgservice.Entity) (pkgservice.OpType, error)
- func (m *MyInfo) Marshal() ([]byte, error)
- func (m *MyInfo) MarshalKey() ([]byte, error)
- func (m *MyInfo) MasterSign(oplog *pkgservice.BaseOplog) error
- func (m *MyInfo) MustSave(isLocked bool) error
- func (m *MyInfo) MyMasterSign(oplog *pkgservice.BaseOplog) error
- func (m *MyInfo) MyPM() pkgservice.MyProtocolManager
- func (m *MyInfo) NewOpKeyInfo(entityID *types.PttID, setOpKeyObjDB func(k *pkgservice.KeyInfo)) (*pkgservice.KeyInfo, error)
- func (m *MyInfo) NodeSignKey() *pkgservice.KeyInfo
- func (m *MyInfo) Save(isLocked bool) error
- func (m *MyInfo) SetUpdateTS(ts types.Timestamp)
- func (m *MyInfo) Sign(oplog *pkgservice.BaseOplog) error
- func (m *MyInfo) SignBlock(block *pkgservice.Block) error
- func (m *MyInfo) SignKey() *pkgservice.KeyInfo
- func (m *MyInfo) Unmarshal(theBytes []byte) error
- type MyNode
- func (m *MyNode) DBPrefix() ([]byte, error)
- func (m *MyNode) Delete(isLocked bool) error
- func (m *MyNode) DeleteRawKey(key []byte) error
- func (m *MyNode) Get(myID *types.PttID, nodeID *discover.NodeID) error
- func (m *MyNode) IntegrateSyncNodeNameInfo(info *SyncNodeNameInfo) (*types.PttID, error)
- func (m *MyNode) Marshal() ([]byte, error)
- func (m *MyNode) MarshalKey() ([]byte, error)
- func (m *MyNode) Save() ([]byte, error)
- func (m *MyNode) Unmarshal(theBytes []byte) error
- type PrivateAPI
- func (api *PrivateAPI) CountPeers(entityID string) (int, error)
- func (api *PrivateAPI) ForceRemoveNode(nodeID string) (bool, error)
- func (api *PrivateAPI) ForceSyncMeMerkle(entityID string) (bool, error)
- func (api *PrivateAPI) GetBoard(entityID string) (*content.BackendGetBoard, error)
- func (api *PrivateAPI) GetBoardRequests(entityID string) ([]*pkgservice.BackendJoinRequest, error)
- func (api *PrivateAPI) GetFriendRequests(entityID string) ([]*pkgservice.BackendJoinRequest, error)
- func (api *PrivateAPI) GetJoinKeyInfos(entityID string) ([]*pkgservice.KeyInfo, error)
- func (api *PrivateAPI) GetMeOplogList(logID string, limit int, listOrder pttdb.ListOrder) ([]*MeOplog, error)
- func (api *PrivateAPI) GetMeOplogMerkleNodeList(entityID string, level uint8, startKey []byte, limit int, ...) ([]*pkgservice.BackendMerkleNode, error)
- func (api *PrivateAPI) GetMeRequests(entityID string) ([]*pkgservice.BackendJoinRequest, error)
- func (api *PrivateAPI) GetMyBoard() (*content.BackendGetBoard, error)
- func (api *PrivateAPI) GetMyMasterOplogList(entityID string, logID string, limit int, listOrder pttdb.ListOrder) ([]*MasterOplog, error)
- func (api *PrivateAPI) GetMyNodes() ([]*MyNode, error)
- func (api *PrivateAPI) GetOpKeyInfos(entityID string) ([]*pkgservice.KeyInfo, error)
- func (api *PrivateAPI) GetOpKeyInfosFromDB(entityID string) ([]*pkgservice.KeyInfo, error)
- func (api *PrivateAPI) GetOpKeyOplogList(entityID string, logID string, limit int, listOrder pttdb.ListOrder) ([]*pkgservice.OpKeyOplog, error)
- func (api *PrivateAPI) GetPeers(entityID string) ([]*pkgservice.BackendPeer, error)
- func (api *PrivateAPI) GetPendingMeOplogInternalList(entityID string, logID string, limit int, listOrder pttdb.ListOrder) ([]*MeOplog, error)
- func (api *PrivateAPI) GetPendingMeOplogMasterList(entityID string, logID string, limit int, listOrder pttdb.ListOrder) ([]*MeOplog, error)
- func (api *PrivateAPI) GetPendingOpKeyOplogInternalList(entityID string, logID string, limit int, listOrder pttdb.ListOrder) ([]*pkgservice.OpKeyOplog, error)
- func (api *PrivateAPI) GetPendingOpKeyOplogMasterList(entityID string, logID string, limit int, listOrder pttdb.ListOrder) ([]*pkgservice.OpKeyOplog, error)
- func (api *PrivateAPI) GetRaftStatus(id string) (*RaftStatus, error)
- func (api *PrivateAPI) GetRawMe(entityID string) (*MyInfo, error)
- func (api *PrivateAPI) GetRawMeOplogList(entityID string, logID string, limit int, listOrder pttdb.ListOrder) ([]*MeOplog, error)
- func (api *PrivateAPI) GetRawMyNodes(entityID string) ([]*MyNode, error)
- func (api *PrivateAPI) GetTotalWeight(entityID string) (uint32, error)
- func (api *PrivateAPI) JoinBoard(friendURL string) (*pkgservice.BackendJoinRequest, error)
- func (api *PrivateAPI) JoinFriend(friendURL string) (*pkgservice.BackendJoinRequest, error)
- func (api *PrivateAPI) JoinMe(meURL string, myKey string, dummy bool) (*pkgservice.BackendJoinRequest, error)
- func (api *PrivateAPI) RefreshMyNodeSignKey() (*pkgservice.KeyInfo, error)
- func (api *PrivateAPI) RefreshMySignKey() (*pkgservice.KeyInfo, error)
- func (api *PrivateAPI) RemoveBoardRequests(entityID string, hash []byte) (bool, error)
- func (api *PrivateAPI) RemoveFriendRequests(entityID string, hash []byte) (bool, error)
- func (api *PrivateAPI) RemoveMeRequests(entityID string, hash []byte) (bool, error)
- func (api *PrivateAPI) RemoveNode(nodeID string) (bool, error)
- func (api *PrivateAPI) RequestRaftLead() (bool, error)
- func (api *PrivateAPI) Revoke(myKey string) (bool, error)
- func (api *PrivateAPI) RevokeOpKey(entityID string, keyID string, myKey string) (bool, error)
- func (api *PrivateAPI) SetMyImage(imgStr string) (*account.UserImg, error)
- func (api *PrivateAPI) SetMyName(name []byte) (*account.UserName, error)
- func (api *PrivateAPI) SetMyNameCard(nameCard []byte) (*account.NameCard, error)
- func (api *PrivateAPI) SetMyNodeName(nodeID string, name []byte) (*MyNode, error)
- func (api *PrivateAPI) ShowMeURL() (*pkgservice.BackendJoinURL, error)
- func (api *PrivateAPI) ShowMyKey() (*types.PttID, error)
- func (api *PrivateAPI) ShowMyMasterKey() ([]byte, error)
- func (api *PrivateAPI) ShowMyNodeKey() ([]byte, error)
- func (api *PrivateAPI) ShowMyNodeSignKey() (*pkgservice.KeyInfo, error)
- func (api *PrivateAPI) ShowMySignKey() (*pkgservice.KeyInfo, error)
- func (api *PrivateAPI) ValidateMyKey(key string) (bool, error)
- func (api *PrivateAPI) ValidateMyMasterKey(masterKeyBytes []byte) (bool, error)
- func (api *PrivateAPI) ValidateMyNodeKey(nodeKeyBytes []byte) (bool, error)
- type ProcessMeInfo
- type ProtocolManager
- func (pm *ProtocolManager) ApproveJoin(joinEntity *pkgservice.JoinEntity, keyInfo *pkgservice.KeyInfo, ...) (*pkgservice.KeyInfo, interface{}, error)
- func (pm *ProtocolManager) ApproveJoinFriend(joinEntity *pkgservice.JoinEntity, keyInfo *pkgservice.KeyInfo, ...) (*pkgservice.KeyInfo, interface{}, error)
- func (pm *ProtocolManager) ApproveJoinMe(joinEntity *pkgservice.JoinEntity, keyInfo *pkgservice.KeyInfo, ...) (*pkgservice.KeyInfo, interface{}, error)
- func (pm *ProtocolManager) BroadcastMeOplog(oplog *MeOplog) error
- func (pm *ProtocolManager) BroadcastMeOplogs(opKeyLogs []*MeOplog) error
- func (pm *ProtocolManager) CleanJoinFriendKey()
- func (pm *ProtocolManager) CleanRaftStorage(isLocked bool) error
- func (pm *ProtocolManager) CreateFullMe(oplog *MasterOplog) error
- func (pm *ProtocolManager) CreateJoinFriendKeyLoop() error
- func (pm *ProtocolManager) CreateMasterOplog(raftIdx uint64, ts types.Timestamp, op pkgservice.OpType, data interface{}) (*MasterOplog, error)
- func (pm *ProtocolManager) CreateMeOplog(objID *types.PttID, ts types.Timestamp, op pkgservice.OpType, data interface{}) (*MeOplog, error)
- func (pm *ProtocolManager) CreateMyBoard(contentBackend *content.Backend) error
- func (pm *ProtocolManager) CreateMyProfile(accountBackend *account.Backend) error
- func (pm *ProtocolManager) DeleteMe() error
- func (pm *ProtocolManager) EnsureRaftLead() error
- func (pm *ProtocolManager) ForceProposeRaftRemoveNode(nodeID *discover.NodeID) error
- func (pm *ProtocolManager) ForceSignMyOplog(oplog *pkgservice.BaseOplog) error
- func (pm *ProtocolManager) ForceSyncMeMerkle() (bool, error)
- func (pm *ProtocolManager) GetBoardRequests() ([]*pkgservice.JoinRequest, error)
- func (pm *ProtocolManager) GetFriendRequests() ([]*pkgservice.JoinRequest, error)
- func (pm *ProtocolManager) GetJoinFriendKey() (*pkgservice.KeyInfo, error)
- func (pm *ProtocolManager) GetJoinFriendKeyFromHash(hash *common.Address) (*pkgservice.KeyInfo, error)
- func (pm *ProtocolManager) GetJoinKeyFromHash(hash *common.Address) (*pkgservice.KeyInfo, error)
- func (pm *ProtocolManager) GetJoinRequest(hash *common.Address) (*pkgservice.JoinRequest, error)
- func (pm *ProtocolManager) GetJoinType(hash *common.Address) (pkgservice.JoinType, error)
- func (pm *ProtocolManager) GetMeOplogList(logID *types.PttID, limit int, listOrder pttdb.ListOrder, status types.Status) ([]*MeOplog, error)
- func (pm *ProtocolManager) GetMeOplogMerkleNodeList(level pkgservice.MerkleTreeLevel, startKey []byte, limit int, ...) ([]*pkgservice.MerkleNode, error)
- func (pm *ProtocolManager) GetMeRequests() ([]*pkgservice.JoinRequest, error)
- func (pm *ProtocolManager) GetMyMasterOplogList(logID *types.PttID, limit int, listOrder pttdb.ListOrder, status types.Status) ([]*MasterOplog, error)
- func (pm *ProtocolManager) GetMyNodeList(isLocked bool) []*MyNode
- func (pm *ProtocolManager) GetPeerType(peer *pkgservice.PttPeer) pkgservice.PeerType
- func (pm *ProtocolManager) GetRaftAppliedIndex(isLocked bool) uint64
- func (pm *ProtocolManager) GetRaftConfState(isLocked bool) pb.ConfState
- func (pm *ProtocolManager) GetRaftLastIndex(isLocked bool) uint64
- func (pm *ProtocolManager) GetRaftLead(isLocked bool) uint64
- func (pm *ProtocolManager) GetRaftSnapshotIndex(isLocked bool) uint64
- func (pm *ProtocolManager) GetRaftStatus() (*RaftStatus, error)
- func (pm *ProtocolManager) HandleAddMeOplog(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleAddMeOplogs(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleAddPendingMeOplog(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleAddPendingMeOplogs(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleApproveJoin(dataBytes []byte, hash *common.Address, joinRequest *pkgservice.JoinRequest, ...) error
- func (pm *ProtocolManager) HandleApproveJoinBoard(dataBytes []byte, joinRequest *pkgservice.JoinRequest, ...) error
- func (pm *ProtocolManager) HandleApproveJoinFriend(dataBytes []byte, joinRequest *pkgservice.JoinRequest, ...) error
- func (pm *ProtocolManager) HandleApproveJoinMe(dataBytes []byte, joinRequest *pkgservice.JoinRequest, ...) error
- func (pm *ProtocolManager) HandleEntityLog(oplog *pkgservice.BaseOplog, spm pkgservice.ServiceProtocolManager, ...) ([]*pkgservice.BaseOplog, error)
- func (pm *ProtocolManager) HandleFailedMeOplog(oplog *pkgservice.BaseOplog) (err error)
- func (pm *ProtocolManager) HandleFailedValidMeOplog(oplog *pkgservice.BaseOplog, processInfo pkgservice.ProcessInfo) (err error)
- func (pm *ProtocolManager) HandleForceSyncMeOplog(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleForceSyncMeOplogAck(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleForceSyncMeOplogByMerkle(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleForceSyncMeOplogByMerkleAck(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleForceSyncMeOplogByOplogAck(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleInitMeInfo(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleInitMeInfoAck(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleInitMeInfoSync(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleInternalSyncBoard(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleInternalSyncBoardAck(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleInternalSyncFriend(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleInternalSyncFriendAck(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleMeOplogs(oplogs []*pkgservice.BaseOplog, peer *pkgservice.PttPeer, ...) error
- func (pm *ProtocolManager) HandleMessage(op pkgservice.OpType, dataBytes []byte, peer *pkgservice.PttPeer) (err error)
- func (pm *ProtocolManager) HandleNonRegisteredMessage(op pkgservice.OpType, dataBytes []byte, peer *pkgservice.PttPeer) (err error)
- func (pm *ProtocolManager) HandlePendingMeOplogs(oplogs []*pkgservice.BaseOplog, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleRevokeMyNode(oplog *MasterOplog, isLockedEntity bool, isLockedNode bool) error
- func (pm *ProtocolManager) HandleRevokeOtherNode(oplog *MasterOplog, node *MyNode, fromID *types.PttID) error
- func (pm *ProtocolManager) HandleSendRaftMsgs(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleSyncMeOplog(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleSyncMeOplogAck(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleSyncMeOplogInvalid(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleSyncNewMeOplog(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleSyncNewMeOplogAck(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleSyncPendingMeOplog(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) HandleSyncPendingMeOplogAck(dataBytes []byte, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) InitMeInfo(peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) InitMeInfoAck(data *InitMeInfo, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) InitMeInfoLoop()
- func (pm *ProtocolManager) InitMeInfoSync(peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) InternalSignMyOplog(oplog *pkgservice.BaseOplog) (bool, error)
- func (pm *ProtocolManager) InternalSyncBoard(oplog *pkgservice.BaseOplog, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) InternalSyncFriend(oplog *pkgservice.BaseOplog, peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) InternalSyncToAlive(oplog *MasterOplog, weight uint32) error
- func (pm *ProtocolManager) IsImportantPeer(peer *pkgservice.PttPeer) bool
- func (pm *ProtocolManager) IsJoinBoardRequests(hash *common.Address) bool
- func (pm *ProtocolManager) IsJoinFriendKeyHash(hash *common.Address) bool
- func (pm *ProtocolManager) IsJoinFriendRequests(hash *common.Address) bool
- func (pm *ProtocolManager) IsJoinMeKeyHash(hash *common.Address) bool
- func (pm *ProtocolManager) IsJoinMeRequests(hash *common.Address) bool
- func (pm *ProtocolManager) IsMaster(id *types.PttID, isLocked bool) bool
- func (pm *ProtocolManager) IsMember(id *types.PttID, isLocked bool) bool
- func (pm *ProtocolManager) IsMemberPeer(peer *pkgservice.PttPeer) bool
- func (pm *ProtocolManager) IsMyDevice(peer *pkgservice.PttPeer) bool
- func (pm *ProtocolManager) IsPendingPeer(peer *pkgservice.PttPeer) bool
- func (pm *ProtocolManager) IsValidInternalOplog(signInfos []*pkgservice.SignInfo) (*types.PttID, uint32, bool)
- func (pm *ProtocolManager) IsValidMyOplog(signInfos []*pkgservice.SignInfo) (*types.PttID, uint32, bool)
- func (pm *ProtocolManager) JoinBoard(joinRequest *pkgservice.JoinRequest) error
- func (pm *ProtocolManager) JoinBoardLoop()
- func (pm *ProtocolManager) JoinFriend(joinRequest *pkgservice.JoinRequest) error
- func (pm *ProtocolManager) JoinFriendKeyList() []*pkgservice.KeyInfo
- func (pm *ProtocolManager) JoinFriendLoop() error
- func (pm *ProtocolManager) JoinMe(joinRequest *pkgservice.JoinRequest, myKeyBytes []byte) error
- func (pm *ProtocolManager) JoinMeLoop() error
- func (pm *ProtocolManager) LoadMyNodes() error
- func (pm *ProtocolManager) LoadPeers() error
- func (pm *ProtocolManager) LoadRaftAppliedIndex(isLocked bool) error
- func (pm *ProtocolManager) LoadRaftConfState(isLocked bool) error
- func (pm *ProtocolManager) LoadRaftLastIndex(isLocked bool) error
- func (pm *ProtocolManager) LoadRaftSnapshotIndex(isLocked bool) error
- func (pm *ProtocolManager) LockMyNodes()
- func (pm *ProtocolManager) MarshalRaftAppliedIndexKey() ([]byte, error)
- func (pm *ProtocolManager) MarshalRaftConfStateKey() ([]byte, error)
- func (pm *ProtocolManager) MarshalRaftLastIndexKey() ([]byte, error)
- func (pm *ProtocolManager) MarshalRaftSnapshotIndexKey() ([]byte, error)
- func (pm *ProtocolManager) Master0Hash() []byte
- func (pm *ProtocolManager) MaybeTriggerRaftSnapshot() error
- func (pm *ProtocolManager) MigrateMe(newMyInfo *MyInfo) error
- func (pm *ProtocolManager) NewMeOplog(objID *types.PttID, op pkgservice.OpType, opData pkgservice.OpData) (pkgservice.Oplog, error)
- func (pm *ProtocolManager) ProposeRaftAddNode(nodeID *discover.NodeID, weight uint32) error
- func (pm *ProtocolManager) ProposeRaftRemoveNode(nodeID *discover.NodeID) error
- func (pm *ProtocolManager) ProposeRaftRequestLead() error
- func (pm *ProtocolManager) PublishRaftEntries(ents []pb.Entry) error
- func (pm *ProtocolManager) PublishRaftSnapshot(snap pb.Snapshot) error
- func (pm *ProtocolManager) Quorum() uint32
- func (pm *ProtocolManager) RLockMyNodes()
- func (pm *ProtocolManager) RUnlockMyNodes()
- func (pm *ProtocolManager) RegisterPeer(peer *pkgservice.PttPeer, peerType pkgservice.PeerType, isLocked bool) error
- func (pm *ProtocolManager) RegisterPendingPeer(peer *pkgservice.PttPeer, isLocked bool) error
- func (pm *ProtocolManager) RemoveBoardRequests(hash []byte) (bool, error)
- func (pm *ProtocolManager) RemoveFriendRequests(hash []byte) (bool, error)
- func (pm *ProtocolManager) RemoveMeRequests(hash []byte) (bool, error)
- func (pm *ProtocolManager) RevokeNode(nodeID *discover.NodeID) error
- func (pm *ProtocolManager) SendRaftMsgs(msgs []pb.Message) error
- func (pm *ProtocolManager) ServeRaftChannels() error
- func (pm *ProtocolManager) ServeRaftProposal()
- func (pm *ProtocolManager) SetMasterDB(oplog *pkgservice.BaseOplog)
- func (pm *ProtocolManager) SetMeDB(oplog *pkgservice.BaseOplog)
- func (pm *ProtocolManager) SetMeOplogIsSync(oplog *MeOplog, isBroadcast bool) (bool, error)
- func (pm *ProtocolManager) SetNewestEntityLog(oplog *pkgservice.BaseOplog, spm pkgservice.ServiceProtocolManager) (types.Bool, error)
- func (pm *ProtocolManager) SetNewestMeOplog(oplog *pkgservice.BaseOplog) (err error)
- func (pm *ProtocolManager) SetRaftAppliedIndex(idx uint64, isLocked bool) error
- func (pm *ProtocolManager) SetRaftConfState(cs pb.ConfState, isLocked bool) error
- func (pm *ProtocolManager) SetRaftLastIndex(idx uint64, isLocked bool) error
- func (pm *ProtocolManager) SetRaftLead(idx uint64, isLocked bool) error
- func (pm *ProtocolManager) SetRaftSnapshotIndex(idx uint64, isLocked bool) error
- func (pm *ProtocolManager) Start() error
- func (pm *ProtocolManager) StartRaft(peers []raft.Peer, isNew bool) error
- func (pm *ProtocolManager) Stop() error
- func (pm *ProtocolManager) StopRaft() error
- func (pm *ProtocolManager) Sync(peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) SyncJoinBoard() error
- func (pm *ProtocolManager) SyncJoinBoardLoop() error
- func (pm *ProtocolManager) SyncJoinFriend() error
- func (pm *ProtocolManager) SyncJoinFriendLoop() error
- func (pm *ProtocolManager) SyncJoinMe() error
- func (pm *ProtocolManager) SyncJoinMeLoop() error
- func (pm *ProtocolManager) SyncPendingMeOplog(peer *pkgservice.PttPeer) error
- func (pm *ProtocolManager) UnlockMyNodes()
- func (pm *ProtocolManager) ValidateIntegrateSignMyOplog(oplog *pkgservice.BaseOplog, isLocked bool) (err error)
- type PublicAPI
- type RaftStatus
- type RaftStorage
- func (rs *RaftStorage) Append(ents []pb.Entry) error
- func (rs *RaftStorage) ApplySnapshot(snap pb.Snapshot) error
- func (rs *RaftStorage) Compact(idx uint64, isLocked bool) error
- func (rs *RaftStorage) CreateSnapshot(i uint64, cs *pb.ConfState, data []byte) (pb.Snapshot, error)
- func (rs *RaftStorage) Entries(startIdx uint64, endIdx uint64, maxSize uint64) ([]pb.Entry, error)
- func (rs *RaftStorage) FirstIndex() (uint64, error)
- func (rs *RaftStorage) GetEntry(idx uint64) (pb.Entry, error)
- func (rs *RaftStorage) GetIdxByKey(key []byte) (uint64, error)
- func (rs *RaftStorage) GetIter(idx uint64) (iterator.Iterator, error)
- func (rs *RaftStorage) GetPrevIter(idx uint64) (iterator.Iterator, error)
- func (rs *RaftStorage) GetTermByIdx(idx uint64) (uint64, error)
- func (rs *RaftStorage) InitialState() (pb.HardState, pb.ConfState, error)
- func (rs *RaftStorage) LastIndex() (uint64, error)
- func (rs *RaftStorage) LoadHardState() (pb.HardState, error)
- func (rs *RaftStorage) LoadSnapshot() (pb.Snapshot, error)
- func (rs *RaftStorage) Lock()
- func (rs *RaftStorage) MarshalKey(idx uint64) ([]byte, error)
- func (rs *RaftStorage) MarshalKeyRaftHardState() ([]byte, error)
- func (rs *RaftStorage) MarshalKeyRaftSnapshot() ([]byte, error)
- func (rs *RaftStorage) SaveEntry(ent pb.Entry, isLocked bool) error
- func (rs *RaftStorage) SetHardState(st pb.HardState) error
- func (rs *RaftStorage) Snapshot() (pb.Snapshot, error)
- func (rs *RaftStorage) Term(idx uint64) (uint64, error)
- func (rs *RaftStorage) Unlock()
- type RequestRaftLead
- type SendRaftMsgs
- type ServiceProtocolManager
- func (spm *ServiceProtocolManager) CreateMe(myID *types.PttID, myKey *ecdsa.PrivateKey, contentBackend *content.Backend) error
- func (spm *ServiceProtocolManager) GetMeList(myID *types.PttID, contentBackend *content.Backend, startingID *types.PttID, ...) (*MyInfo, []*MyInfo, error)
- func (spm *ServiceProtocolManager) NewEmptyEntity() pkgservice.Entity
- type SyncNodeNameInfo
Constants ¶
View Source
const ( JoinFriendMsg pkgservice.OpType // me-oplog AddMeOplogMsg AddMeOplogsMsg AddPendingMeOplogMsg AddPendingMeOplogsMsg SyncMeOplogMsg // 47 SyncMeOplogAckMsg SyncMeOplogNewOplogsMsg SyncMeOplogNewOplogsAckMsg InvalidSyncMeOplogMsg ForceSyncMeOplogMsg ForceSyncMeOplogAckMsg ForceSyncMeOplogByMerkleMsg ForceSyncMeOplogByMerkleAckMsg ForceSyncMeOplogByOplogAckMsg SyncPendingMeOplogMsg SyncPendingMeOplogAckMsg SendRaftMsgsMsg // 53 RequestRaftLeadMsg // init-me-info InitMeInfoMsg InitMeInfoAckMsg InitMeInfoSyncMsg // sync-board InternalSyncBoardMsg InternalSyncBoardAckMsg // sync-friend InternalSyncFriendMsg InternalSyncFriendAckMsg )
protocol
View Source
const ( MaxSyncRandomSeconds = 8 MinSyncRandomSeconds = 5 )
sync
View Source
const ( SyncJoinSeconds = 10 * time.Second RenewJoinFriendKeySeconds = pkgservice.RenewJoinKeySeconds )
join
View Source
const ( GenerateMeOplogMerkleTreeSeconds = 10 * time.Second ExpireGenerateMeOplogMerkleTreeSeconds = 60 OffsetGenerateMeOplogMerkleTreeSeconds = 7200 SleepTimeMeLock = 10 )
me-oplog
View Source
const ( OffsetMasterOplogRaftIdx = 12 SleepTimeMasterLock = 10 )
master-oplog
View Source
const ( RaftTickTime = 100 * time.Millisecond RaftElectionTick = 50 RaftHeartbeatTick = 5 RaftMaxSizePerMsg = 1024 * 1024 RaftMaxInflightMsgs = 16 NRequestRaftLead = 10 )
View Source
const ( WeightServer = 2000000 WeightDesktop = 2000 WeightMobile = 2 )
weight
View Source
const ( MasterOpTypeAddMaster pkgservice.OpType MasterOpTypeRevokeMaster )
View Source
const ( MeOpTypeInvalid pkgservice.OpType = iota MeOpTypeCreateMe MeOpTypeSetNodeName OffsetMeOpTypeEntity MeOpTypeCreateBoard MeOpTypeJoinBoard MeOpTypeCreateFriend MeOpTypeJoinFriend MeOpTypeMigrateMe MeOpTypeDeleteMe NMeOpType )
View Source
const (
InitMeInfoTickTime = 3 * time.Second
)
View Source
const (
MaxMasters = 0
)
View Source
const (
NRenewSignKey = 100
)
sign-key
Variables ¶
View Source
var ( ErrInvalidMe = errors.New("invalid me") ErrInvalidNode = errors.New("invalid node") ErrInvalidPrivateKeyPostfix = errors.New("private-key and postfix must be specified at the same time") ErrInvalidPrivateKey = errors.New("invalid private key") ErrInvalidPrivateKeyFileHex = errors.New("cannot set private-key file / hex at the same time") ErrInvalidPrivateKeyFile = errors.New("invalid private key file") ErrInvalidPrivateKeyHex = errors.New("invalid private key hex") ErrAlreadyMyNode = errors.New("already my node") ErrInvalidEntry = errors.New("invalid raft entry") ErrInvalidRaftIndex = errors.New("invalid raft index") ErrUnableToBeLead = errors.New("unable to be lead") ErrWithLead = errors.New("with lead") )
View Source
var ( DataDirPrivateKey = "mykey" DefaultTitle = []byte("") )
defaults
View Source
var ( SleepTimeLock = 10 DBMePrefix = []byte(".medb") DBMyNodePrefix = []byte(".mndb") DBRaftPrefix = []byte(".rfdb") DBKeyRaftHardState = []byte(".rfhs") DBKeyRaftSnapshot = []byte(".rfsn") // raft in me DBKeyRaftLastIndex = []byte(".rfli") DBKeyRaftAppliedIndex = []byte(".rfai") DBKeyRaftSnapshotIndex = []byte(".rfsi") DBKeyRaftConfState = []byte(".rfcs") DBKeyRaftLead = []byte(".rfld") )
db
View Source
var ( RenewOpKeySeconds int64 = 86400 ExpireOpKeySeconds int64 = 259200 )
op-key
View Source
var ( DBMeOplogPrefix = []byte(".melg") DBMeIdxOplogPrefix = []byte(".meig") DBMeMerkleOplogPrefix = []byte(".memk") DBMasterOplogPrefix = []byte(".malg") DBMasterIdxOplogPrefix = []byte(".maig") )
oplog
View Source
var ( DefaultConfig = Config{ DataDir: filepath.Join(node.DefaultDataDir(), "me"), } )
default config
View Source
var (
MasterIDZeros = make([]byte, OffsetMasterOplogRaftIdx)
)
Functions ¶
func CleanRaftStorage ¶
func CleanRaftStorage(myID *types.PttID, rs *RaftStorage, isLocked bool) error
func MasterOplogsToOplogs ¶
func MasterOplogsToOplogs(typedLogs []*MasterOplog) []*pkgservice.BaseOplog
func MeOplogsToOplogs ¶
func MeOplogsToOplogs(typedLogs []*MeOplog) []*pkgservice.BaseOplog
func ProtocolJoinBoardLogs ¶
func ProtocolJoinBoardLogs() error
func ProtocolJoinFriendLogs ¶
func ProtocolJoinFriendLogs() error
func TeardownMe ¶
func TeardownMe()
Types ¶
type ApproveJoinFriend ¶
type ApproveJoinFriend struct {
FriendData *friend.ApproveJoin `json:"F"`
}
type ApproveJoinMe ¶
type ApproveJoinMe struct { MyInfo *MyInfo `json:"M"` OpKeyInfo *pkgservice.KeyInfo `json:"O"` }
type Backend ¶
type Backend struct { *pkgservice.BaseService Config *Config // contains filtered or unexported fields }
func NewBackend ¶
func NewBackend(ctx *pkgservice.ServiceContext, cfg *Config, ptt pkgservice.MyPtt, accountBackend *account.Backend, contentBackend *content.Backend, friendBacked *friend.Backend) (*Backend, error)
func (*Backend) ForceSyncMeMerkle ¶
func (*Backend) Get ¶
func (b *Backend) Get() (*BackendMyInfo, error)
func (*Backend) GetBoard ¶
func (b *Backend) GetBoard(entityIDBytes []byte) (*content.BackendGetBoard, error)
func (*Backend) GetBoardRequests ¶
func (b *Backend) GetBoardRequests(entityIDBytes []byte) ([]*pkgservice.BackendJoinRequest, error)
func (*Backend) GetFriendRequests ¶
func (b *Backend) GetFriendRequests(entityIDBytes []byte) ([]*pkgservice.BackendJoinRequest, error)
func (*Backend) GetJoinKeys ¶
func (b *Backend) GetJoinKeys(entityIDBytes []byte) ([]*pkgservice.KeyInfo, error)
func (*Backend) GetMeList ¶
func (b *Backend) GetMeList() ([]*BackendMyInfo, error)
func (*Backend) GetMeOplogList ¶
func (*Backend) GetMeOplogMerkleNodeList ¶
func (b *Backend) GetMeOplogMerkleNodeList(entityIDBytes []byte, level pkgservice.MerkleTreeLevel, startKey []byte, limit int, listOrder pttdb.ListOrder) ([]*pkgservice.BackendMerkleNode, error)
func (*Backend) GetMeRequests ¶
func (b *Backend) GetMeRequests(entityIDBytes []byte) ([]*pkgservice.BackendJoinRequest, error)
func (*Backend) GetMyIDStr ¶
func (*Backend) GetMyMasterOplogList ¶
func (*Backend) GetMyProfile ¶
func (*Backend) GetPendingMeOplogInternalList ¶
func (*Backend) GetPendingMeOplogMasterList ¶
func (*Backend) GetRaftStatus ¶
func (b *Backend) GetRaftStatus(entityIDBytes []byte) (*RaftStatus, error)
func (*Backend) GetTotalWeight ¶
func (*Backend) JoinBoard ¶
func (b *Backend) JoinBoard(friendURL []byte) (*pkgservice.BackendJoinRequest, error)
func (*Backend) JoinFriend ¶
func (b *Backend) JoinFriend(friendURL []byte) (*pkgservice.BackendJoinRequest, error)
func (*Backend) JoinMe ¶
func (b *Backend) JoinMe(meURL []byte, myKeyBytes []byte) (*pkgservice.BackendJoinRequest, error)
func (*Backend) RefreshMyNodeSignKey ¶
func (b *Backend) RefreshMyNodeSignKey() (*pkgservice.KeyInfo, error)
func (*Backend) RefreshMySignKey ¶
func (b *Backend) RefreshMySignKey() (*pkgservice.KeyInfo, error)
func (*Backend) RemoveBoardRequests ¶
func (*Backend) RemoveFriendRequests ¶
func (*Backend) RemoveMeRequests ¶
func (*Backend) RequestRaftLead ¶
func (*Backend) SetMyNameCard ¶
func (*Backend) SetMyNodeName ¶
func (*Backend) ShowMeURL ¶
func (b *Backend) ShowMeURL() (*pkgservice.BackendJoinURL, error)
func (*Backend) ShowMyMasterKey ¶
func (*Backend) ShowMyNodeKey ¶
func (*Backend) ShowMyNodeSignKey ¶
func (b *Backend) ShowMyNodeSignKey() (*pkgservice.KeyInfo, error)
func (*Backend) ShowMySignKey ¶
func (b *Backend) ShowMySignKey() (*pkgservice.KeyInfo, error)
func (*Backend) ShowURL ¶
func (b *Backend) ShowURL() (*pkgservice.BackendJoinURL, error)
func (*Backend) ValidateMyMasterKey ¶
type BackendMyInfo ¶
type BackendMyInfo struct { V types.Version ID *types.PttID CreateTS types.Timestamp `json:"CT"` UpdateTS types.Timestamp `json:"UT"` Status types.Status `json:"S"` RaftID uint64 NodeID *discover.NodeID }
func MarshalBackendMyInfo ¶
func MarshalBackendMyInfo(m *MyInfo, ptt pkgservice.MyPtt) *BackendMyInfo
type Config ¶
type Config struct { DataDir string PrivateKey *ecdsa.PrivateKey `toml:"-"` ID *types.PttID `toml:"-"` // we also need ID because other services need to know ID, but cannot directly acccess private-key and postfix. Postfix string }
func (*Config) GetDataPrivateKeyByID ¶
func (*Config) ResolvePath ¶
resolvePath resolves path in the instance directory.
func (*Config) ResolvePrivateKeyWithIDPath ¶
type InitMeInfo ¶
type InitMeInfoAck ¶
type InitMeInfoSync ¶
type InitMeInfoSync struct { KeyBytes []byte `json:"K"` PostfixBytes []byte `json:"P"` Oplog0 *pkgservice.BaseOplog `json:"O"` ProfileData *account.ApproveJoinEntity `json:"p"` BoardData *pkgservice.ApproveJoinEntity `json:"b"` }
type InternalSyncBoardAck ¶
type InternalSyncBoardAck struct { LogID *types.PttID `json:"l"` BoardData *pkgservice.ApproveJoinEntity `json:"B"` }
type InternalSyncFriendAck ¶
type InternalSyncFriendAck struct { LogID *types.PttID `json:"l"` InitFriendInfoAck *friend.InitFriendInfoAck `json:"i"` }
type JoinBoardEvent ¶
type JoinBoardEvent struct {
JoinRequest *pkgservice.JoinRequest
}
type JoinFriendEvent ¶
type JoinFriendEvent struct {
JoinRequest *pkgservice.JoinRequest
}
type JoinMeEvent ¶
type JoinMeEvent struct {
JoinMeRequest *pkgservice.JoinRequest
}
type JoinMeRequest ¶
type JoinMeRequest struct { JoinRequest *pkgservice.JoinRequest NodeType pkgservice.NodeType }
type MasterOpAddMaster ¶
type MasterOpRevokeMaster ¶
type MasterOplog ¶
type MasterOplog struct {
*pkgservice.BaseOplog `json:"O"`
}
func NewMasterOplog ¶
func OplogsToMasterOplogs ¶
func OplogsToMasterOplogs(logs []*pkgservice.BaseOplog) []*MasterOplog
type MeOpCreateMe ¶
type MeOpCreateMe struct { NodeID *discover.NodeID `json:"NID"` NodeType pkgservice.NodeType `json:"NT"` NodeName []byte `json:"n"` }
type MeOpDeleteMe ¶
type MeOpDeleteMe struct{}
type MeOpEntity ¶
type MeOpMigrateMe ¶
type MeOpSetNodeName ¶
type MeOplog ¶
type MeOplog struct {
*pkgservice.BaseOplog `json:"O"`
}
func NewMeOplog ¶
func OplogToMeOplog ¶
func OplogToMeOplog(oplog *pkgservice.BaseOplog) *MeOplog
func OplogsToMeOplogs ¶
func OplogsToMeOplogs(logs []*pkgservice.BaseOplog) []*MeOplog
func (*MeOplog) GetBaseOplog ¶
func (o *MeOplog) GetBaseOplog() *pkgservice.BaseOplog
type MyInfo ¶
type MyInfo struct { *pkgservice.BaseEntity `json:"e"` UpdateTS types.Timestamp `json:"UT"` ProfileID *types.PttID `json:"PID"` Profile *account.Profile `json:"-"` BoardID *types.PttID `json:"BID"` Board *content.Board `json:"-"` NodeSignID *types.PttID `json:"-"` // contains filtered or unexported fields }
func NewEmptyMyInfo ¶
func NewEmptyMyInfo() *MyInfo
func NewMyInfo ¶
func NewMyInfo(id *types.PttID, myKey *ecdsa.PrivateKey, ptt pkgservice.MyPtt, service pkgservice.Service, spm pkgservice.ServiceProtocolManager, dbLock *types.LockMap) (*MyInfo, error)
func (*MyInfo) CreateEntityOpType ¶
func (m *MyInfo) CreateEntityOpType(entity pkgservice.Entity) (pkgservice.OpType, error)
func (*MyInfo) CreateEntityOplog ¶
func (m *MyInfo) CreateEntityOplog(entity pkgservice.Entity) error
func (*MyInfo) CreateJoinEntityOplog ¶
func (m *MyInfo) CreateJoinEntityOplog(entity pkgservice.Entity) error
func (*MyInfo) CreateNodeSignKeyInfo ¶
func (*MyInfo) CreateSignKeyInfo ¶
func (*MyInfo) GetBoard ¶
func (m *MyInfo) GetBoard() pkgservice.Entity
func (*MyInfo) GetJoinRequest ¶
func (m *MyInfo) GetJoinRequest(hash *common.Address) (*pkgservice.JoinRequest, error)
func (*MyInfo) GetLenNodes ¶
func (*MyInfo) GetMasterKey ¶
func (m *MyInfo) GetMasterKey() *ecdsa.PrivateKey
func (*MyInfo) GetMyKey ¶
func (m *MyInfo) GetMyKey() *ecdsa.PrivateKey
func (*MyInfo) GetNodeKey ¶
func (m *MyInfo) GetNodeKey() *ecdsa.PrivateKey
func (*MyInfo) GetNodeSignID ¶
func (*MyInfo) GetProfile ¶
func (m *MyInfo) GetProfile() pkgservice.Entity
func (*MyInfo) GetUpdateTS ¶
func (*MyInfo) GetUserNodeID ¶
func (*MyInfo) GetValidateKey ¶
func (*MyInfo) HandleApproveJoin ¶
func (m *MyInfo) HandleApproveJoin(dataBytes []byte, hash *common.Address, joinRequest *pkgservice.JoinRequest, peer *pkgservice.PttPeer) error
func (*MyInfo) Init ¶
func (m *MyInfo) Init(thePtt pkgservice.Ptt, service pkgservice.Service, spm pkgservice.ServiceProtocolManager) error
func (*MyInfo) InitPM ¶
func (m *MyInfo) InitPM(ptt pkgservice.MyPtt, service pkgservice.Service) error
func (*MyInfo) InternalSign ¶
func (m *MyInfo) InternalSign(oplog *pkgservice.BaseOplog) error
func (*MyInfo) IsValidInternalOplog ¶
func (*MyInfo) JoinEntityOpType ¶
func (m *MyInfo) JoinEntityOpType(entity pkgservice.Entity) (pkgservice.OpType, error)
func (*MyInfo) MarshalKey ¶
func (*MyInfo) MasterSign ¶
func (m *MyInfo) MasterSign(oplog *pkgservice.BaseOplog) error
func (*MyInfo) MyMasterSign ¶
func (m *MyInfo) MyMasterSign(oplog *pkgservice.BaseOplog) error
func (*MyInfo) MyPM ¶
func (m *MyInfo) MyPM() pkgservice.MyProtocolManager
func (*MyInfo) NewOpKeyInfo ¶
func (m *MyInfo) NewOpKeyInfo(entityID *types.PttID, setOpKeyObjDB func(k *pkgservice.KeyInfo)) (*pkgservice.KeyInfo, error)
func (*MyInfo) NodeSignKey ¶
func (m *MyInfo) NodeSignKey() *pkgservice.KeyInfo
func (*MyInfo) SetUpdateTS ¶
func (*MyInfo) SignKey ¶
func (m *MyInfo) SignKey() *pkgservice.KeyInfo
type MyNode ¶
type MyNode struct { V types.Version ID *types.PttID CreateTS types.Timestamp `json:"CT"` UpdateTS types.Timestamp `json:"UT"` Status types.Status `json:"S"` LastSeen types.Timestamp `json:"L"` NodeName []byte `json:"N,omitempty"` NodeNameLogID *types.PttID `json:"nl,omitempty"` SyncNodeNameInfo *SyncNodeNameInfo `json:"sn,omitempty"` NodeID *discover.NodeID `json:"NID"` NodeType pkgservice.NodeType `json:"NT"` Weight uint32 `json:"W"` LogID *types.PttID `json:"pl,omitempty"` RaftID uint64 `json:"R"` Peer *pkgservice.PttPeer `json:"-"` }
func (*MyNode) DeleteRawKey ¶
func (*MyNode) IntegrateSyncNodeNameInfo ¶
func (m *MyNode) IntegrateSyncNodeNameInfo(info *SyncNodeNameInfo) (*types.PttID, error)
func (*MyNode) MarshalKey ¶
type PrivateAPI ¶
type PrivateAPI struct {
// contains filtered or unexported fields
}
func NewPrivateAPI ¶
func NewPrivateAPI(b *Backend) *PrivateAPI
func (*PrivateAPI) CountPeers ¶
func (api *PrivateAPI) CountPeers(entityID string) (int, error)
func (*PrivateAPI) ForceRemoveNode ¶
func (api *PrivateAPI) ForceRemoveNode(nodeID string) (bool, error)
func (*PrivateAPI) ForceSyncMeMerkle ¶
func (api *PrivateAPI) ForceSyncMeMerkle(entityID string) (bool, error)
func (*PrivateAPI) GetBoard ¶
func (api *PrivateAPI) GetBoard(entityID string) (*content.BackendGetBoard, error)
func (*PrivateAPI) GetBoardRequests ¶
func (api *PrivateAPI) GetBoardRequests(entityID string) ([]*pkgservice.BackendJoinRequest, error)
GetBoardRequests get the friend-requests from me to the others.
func (*PrivateAPI) GetFriendRequests ¶
func (api *PrivateAPI) GetFriendRequests(entityID string) ([]*pkgservice.BackendJoinRequest, error)
GetFriendRequests get the friend-requests from me to the others.
func (*PrivateAPI) GetJoinKeyInfos ¶
func (api *PrivateAPI) GetJoinKeyInfos(entityID string) ([]*pkgservice.KeyInfo, error)
func (*PrivateAPI) GetMeOplogList ¶
func (*PrivateAPI) GetMeOplogMerkleNodeList ¶
func (api *PrivateAPI) GetMeOplogMerkleNodeList(entityID string, level uint8, startKey []byte, limit int, listOrder pttdb.ListOrder) ([]*pkgservice.BackendMerkleNode, error)
func (*PrivateAPI) GetMeRequests ¶
func (api *PrivateAPI) GetMeRequests(entityID string) ([]*pkgservice.BackendJoinRequest, error)
GetMeRequests get the me-requests from me to the others.
func (*PrivateAPI) GetMyBoard ¶
func (api *PrivateAPI) GetMyBoard() (*content.BackendGetBoard, error)
func (*PrivateAPI) GetMyMasterOplogList ¶
func (api *PrivateAPI) GetMyMasterOplogList(entityID string, logID string, limit int, listOrder pttdb.ListOrder) ([]*MasterOplog, error)
func (*PrivateAPI) GetMyNodes ¶
func (api *PrivateAPI) GetMyNodes() ([]*MyNode, error)
func (*PrivateAPI) GetOpKeyInfos ¶
func (api *PrivateAPI) GetOpKeyInfos(entityID string) ([]*pkgservice.KeyInfo, error)
*********
- Op *********
func (*PrivateAPI) GetOpKeyInfosFromDB ¶
func (api *PrivateAPI) GetOpKeyInfosFromDB(entityID string) ([]*pkgservice.KeyInfo, error)
func (*PrivateAPI) GetOpKeyOplogList ¶
func (api *PrivateAPI) GetOpKeyOplogList(entityID string, logID string, limit int, listOrder pttdb.ListOrder) ([]*pkgservice.OpKeyOplog, error)
func (*PrivateAPI) GetPeers ¶
func (api *PrivateAPI) GetPeers(entityID string) ([]*pkgservice.BackendPeer, error)
func (*PrivateAPI) GetPendingMeOplogInternalList ¶
func (*PrivateAPI) GetPendingMeOplogMasterList ¶
func (*PrivateAPI) GetPendingOpKeyOplogInternalList ¶
func (api *PrivateAPI) GetPendingOpKeyOplogInternalList(entityID string, logID string, limit int, listOrder pttdb.ListOrder) ([]*pkgservice.OpKeyOplog, error)
func (*PrivateAPI) GetPendingOpKeyOplogMasterList ¶
func (api *PrivateAPI) GetPendingOpKeyOplogMasterList(entityID string, logID string, limit int, listOrder pttdb.ListOrder) ([]*pkgservice.OpKeyOplog, error)
func (*PrivateAPI) GetRaftStatus ¶
func (api *PrivateAPI) GetRaftStatus(id string) (*RaftStatus, error)
func (*PrivateAPI) GetRawMeOplogList ¶
func (*PrivateAPI) GetRawMyNodes ¶
func (api *PrivateAPI) GetRawMyNodes(entityID string) ([]*MyNode, error)
func (*PrivateAPI) GetTotalWeight ¶
func (api *PrivateAPI) GetTotalWeight(entityID string) (uint32, error)
func (*PrivateAPI) JoinBoard ¶
func (api *PrivateAPI) JoinBoard(friendURL string) (*pkgservice.BackendJoinRequest, error)
func (*PrivateAPI) JoinFriend ¶
func (api *PrivateAPI) JoinFriend(friendURL string) (*pkgservice.BackendJoinRequest, error)
func (*PrivateAPI) JoinMe ¶
func (api *PrivateAPI) JoinMe(meURL string, myKey string, dummy bool) (*pkgservice.BackendJoinRequest, error)
func (*PrivateAPI) RefreshMyNodeSignKey ¶
func (api *PrivateAPI) RefreshMyNodeSignKey() (*pkgservice.KeyInfo, error)
func (*PrivateAPI) RefreshMySignKey ¶
func (api *PrivateAPI) RefreshMySignKey() (*pkgservice.KeyInfo, error)
func (*PrivateAPI) RemoveBoardRequests ¶
func (api *PrivateAPI) RemoveBoardRequests(entityID string, hash []byte) (bool, error)
func (*PrivateAPI) RemoveFriendRequests ¶
func (api *PrivateAPI) RemoveFriendRequests(entityID string, hash []byte) (bool, error)
func (*PrivateAPI) RemoveMeRequests ¶
func (api *PrivateAPI) RemoveMeRequests(entityID string, hash []byte) (bool, error)
func (*PrivateAPI) RemoveNode ¶
func (api *PrivateAPI) RemoveNode(nodeID string) (bool, error)
func (*PrivateAPI) RequestRaftLead ¶
func (api *PrivateAPI) RequestRaftLead() (bool, error)
func (*PrivateAPI) RevokeOpKey ¶
func (*PrivateAPI) SetMyImage ¶
func (api *PrivateAPI) SetMyImage(imgStr string) (*account.UserImg, error)
func (*PrivateAPI) SetMyName ¶
func (api *PrivateAPI) SetMyName(name []byte) (*account.UserName, error)
func (*PrivateAPI) SetMyNameCard ¶
func (api *PrivateAPI) SetMyNameCard(nameCard []byte) (*account.NameCard, error)
func (*PrivateAPI) SetMyNodeName ¶
func (api *PrivateAPI) SetMyNodeName(nodeID string, name []byte) (*MyNode, error)
func (*PrivateAPI) ShowMeURL ¶
func (api *PrivateAPI) ShowMeURL() (*pkgservice.BackendJoinURL, error)
func (*PrivateAPI) ShowMyMasterKey ¶
func (api *PrivateAPI) ShowMyMasterKey() ([]byte, error)
func (*PrivateAPI) ShowMyNodeKey ¶
func (api *PrivateAPI) ShowMyNodeKey() ([]byte, error)
func (*PrivateAPI) ShowMyNodeSignKey ¶
func (api *PrivateAPI) ShowMyNodeSignKey() (*pkgservice.KeyInfo, error)
func (*PrivateAPI) ShowMySignKey ¶
func (api *PrivateAPI) ShowMySignKey() (*pkgservice.KeyInfo, error)
func (*PrivateAPI) ValidateMyKey ¶
func (api *PrivateAPI) ValidateMyKey(key string) (bool, error)
func (*PrivateAPI) ValidateMyMasterKey ¶
func (api *PrivateAPI) ValidateMyMasterKey(masterKeyBytes []byte) (bool, error)
func (*PrivateAPI) ValidateMyNodeKey ¶
func (api *PrivateAPI) ValidateMyNodeKey(nodeKeyBytes []byte) (bool, error)
type ProcessMeInfo ¶
type ProcessMeInfo struct { DeleteMeInfo map[types.PttID]*pkgservice.BaseOplog MetaInfo map[types.PttID]*pkgservice.BaseOplog BoardInfo map[types.PttID]*pkgservice.BaseOplog FriendInfo map[types.PttID]*pkgservice.BaseOplog }
func NewProcessMeInfo ¶
func NewProcessMeInfo() *ProcessMeInfo
type ProtocolManager ¶
type ProtocolManager struct { *pkgservice.BaseProtocolManager MyNodes map[uint64]*MyNode MyNodeByNodeSignIDs map[types.PttID]*MyNode // contains filtered or unexported fields }
func NewProtocolManager ¶
func NewProtocolManager(myInfo *MyInfo, ptt pkgservice.MyPtt, svc pkgservice.Service) (*ProtocolManager, error)
func (*ProtocolManager) ApproveJoin ¶
func (pm *ProtocolManager) ApproveJoin(joinEntity *pkgservice.JoinEntity, keyInfo *pkgservice.KeyInfo, peer *pkgservice.PttPeer) (*pkgservice.KeyInfo, interface{}, error)
func (*ProtocolManager) ApproveJoinFriend ¶
func (pm *ProtocolManager) ApproveJoinFriend(joinEntity *pkgservice.JoinEntity, keyInfo *pkgservice.KeyInfo, peer *pkgservice.PttPeer) (*pkgservice.KeyInfo, interface{}, error)
func (*ProtocolManager) ApproveJoinMe ¶
func (pm *ProtocolManager) ApproveJoinMe(joinEntity *pkgservice.JoinEntity, keyInfo *pkgservice.KeyInfo, peer *pkgservice.PttPeer) (*pkgservice.KeyInfo, interface{}, error)
ApproveJoinMe deals with procedure of approving-join-me:
- set peer-type as me
- propose raft.
func (*ProtocolManager) BroadcastMeOplog ¶
func (pm *ProtocolManager) BroadcastMeOplog(oplog *MeOplog) error
func (*ProtocolManager) BroadcastMeOplogs ¶
func (pm *ProtocolManager) BroadcastMeOplogs(opKeyLogs []*MeOplog) error
func (*ProtocolManager) CleanJoinFriendKey ¶
func (pm *ProtocolManager) CleanJoinFriendKey()
func (*ProtocolManager) CleanRaftStorage ¶
func (pm *ProtocolManager) CleanRaftStorage(isLocked bool) error
func (*ProtocolManager) CreateFullMe ¶
func (pm *ProtocolManager) CreateFullMe(oplog *MasterOplog) error
func (*ProtocolManager) CreateJoinFriendKeyLoop ¶
func (pm *ProtocolManager) CreateJoinFriendKeyLoop() error
func (*ProtocolManager) CreateMasterOplog ¶
func (pm *ProtocolManager) CreateMasterOplog(raftIdx uint64, ts types.Timestamp, op pkgservice.OpType, data interface{}) (*MasterOplog, error)
func (*ProtocolManager) CreateMeOplog ¶
func (pm *ProtocolManager) CreateMeOplog(objID *types.PttID, ts types.Timestamp, op pkgservice.OpType, data interface{}) (*MeOplog, error)
func (*ProtocolManager) CreateMyBoard ¶
func (pm *ProtocolManager) CreateMyBoard(contentBackend *content.Backend) error
func (*ProtocolManager) CreateMyProfile ¶
func (pm *ProtocolManager) CreateMyProfile(accountBackend *account.Backend) error
func (*ProtocolManager) DeleteMe ¶
func (pm *ProtocolManager) DeleteMe() error
func (*ProtocolManager) EnsureRaftLead ¶
func (pm *ProtocolManager) EnsureRaftLead() error
func (*ProtocolManager) ForceProposeRaftRemoveNode ¶
func (pm *ProtocolManager) ForceProposeRaftRemoveNode(nodeID *discover.NodeID) error
func (*ProtocolManager) ForceSignMyOplog ¶
func (pm *ProtocolManager) ForceSignMyOplog(oplog *pkgservice.BaseOplog) error
func (*ProtocolManager) ForceSyncMeMerkle ¶
func (pm *ProtocolManager) ForceSyncMeMerkle() (bool, error)
func (*ProtocolManager) GetBoardRequests ¶
func (pm *ProtocolManager) GetBoardRequests() ([]*pkgservice.JoinRequest, error)
func (*ProtocolManager) GetFriendRequests ¶
func (pm *ProtocolManager) GetFriendRequests() ([]*pkgservice.JoinRequest, error)
func (*ProtocolManager) GetJoinFriendKey ¶
func (pm *ProtocolManager) GetJoinFriendKey() (*pkgservice.KeyInfo, error)
func (*ProtocolManager) GetJoinFriendKeyFromHash ¶
func (pm *ProtocolManager) GetJoinFriendKeyFromHash(hash *common.Address) (*pkgservice.KeyInfo, error)
func (*ProtocolManager) GetJoinKeyFromHash ¶
func (pm *ProtocolManager) GetJoinKeyFromHash(hash *common.Address) (*pkgservice.KeyInfo, error)
func (*ProtocolManager) GetJoinRequest ¶
func (pm *ProtocolManager) GetJoinRequest(hash *common.Address) (*pkgservice.JoinRequest, error)
func (*ProtocolManager) GetJoinType ¶
func (pm *ProtocolManager) GetJoinType(hash *common.Address) (pkgservice.JoinType, error)
func (*ProtocolManager) GetMeOplogList ¶
func (pm *ProtocolManager) GetMeOplogList(logID *types.PttID, limit int, listOrder pttdb.ListOrder, status types.Status) ([]*MeOplog, error)
GetMeOplogList gets the MeOplogs specifically from myEntity.
func (*ProtocolManager) GetMeOplogMerkleNodeList ¶
func (pm *ProtocolManager) GetMeOplogMerkleNodeList(level pkgservice.MerkleTreeLevel, startKey []byte, limit int, listOrder pttdb.ListOrder) ([]*pkgservice.MerkleNode, error)
func (*ProtocolManager) GetMeRequests ¶
func (pm *ProtocolManager) GetMeRequests() ([]*pkgservice.JoinRequest, error)
func (*ProtocolManager) GetMyMasterOplogList ¶
func (pm *ProtocolManager) GetMyMasterOplogList(logID *types.PttID, limit int, listOrder pttdb.ListOrder, status types.Status) ([]*MasterOplog, error)
func (*ProtocolManager) GetMyNodeList ¶
func (pm *ProtocolManager) GetMyNodeList(isLocked bool) []*MyNode
func (*ProtocolManager) GetPeerType ¶
func (pm *ProtocolManager) GetPeerType(peer *pkgservice.PttPeer) pkgservice.PeerType
func (*ProtocolManager) GetRaftAppliedIndex ¶
func (pm *ProtocolManager) GetRaftAppliedIndex(isLocked bool) uint64
func (*ProtocolManager) GetRaftConfState ¶
func (pm *ProtocolManager) GetRaftConfState(isLocked bool) pb.ConfState
func (*ProtocolManager) GetRaftLastIndex ¶
func (pm *ProtocolManager) GetRaftLastIndex(isLocked bool) uint64
func (*ProtocolManager) GetRaftLead ¶
func (pm *ProtocolManager) GetRaftLead(isLocked bool) uint64
func (*ProtocolManager) GetRaftSnapshotIndex ¶
func (pm *ProtocolManager) GetRaftSnapshotIndex(isLocked bool) uint64
func (*ProtocolManager) GetRaftStatus ¶
func (pm *ProtocolManager) GetRaftStatus() (*RaftStatus, error)
func (*ProtocolManager) HandleAddMeOplog ¶
func (pm *ProtocolManager) HandleAddMeOplog(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleAddMeOplogs ¶
func (pm *ProtocolManager) HandleAddMeOplogs(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleAddPendingMeOplog ¶
func (pm *ProtocolManager) HandleAddPendingMeOplog(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleAddPendingMeOplogs ¶
func (pm *ProtocolManager) HandleAddPendingMeOplogs(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleApproveJoin ¶
func (pm *ProtocolManager) HandleApproveJoin(dataBytes []byte, hash *common.Address, joinRequest *pkgservice.JoinRequest, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleApproveJoinBoard ¶
func (pm *ProtocolManager) HandleApproveJoinBoard(dataBytes []byte, joinRequest *pkgservice.JoinRequest, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleApproveJoinFriend ¶
func (pm *ProtocolManager) HandleApproveJoinFriend(dataBytes []byte, joinRequest *pkgservice.JoinRequest, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleApproveJoinMe ¶
func (pm *ProtocolManager) HandleApproveJoinMe(dataBytes []byte, joinRequest *pkgservice.JoinRequest, peer *pkgservice.PttPeer) error
HandleApproveJoinMe deals with procedure of handling-approve-join-me:
func (*ProtocolManager) HandleEntityLog ¶
func (pm *ProtocolManager) HandleEntityLog( oplog *pkgservice.BaseOplog, spm pkgservice.ServiceProtocolManager, opData *MeOpEntity, info *ProcessMeInfo, updateCreateEntityInfo func(oplog *pkgservice.BaseOplog, info *ProcessMeInfo), ) ([]*pkgservice.BaseOplog, error)
func (*ProtocolManager) HandleFailedMeOplog ¶
func (pm *ProtocolManager) HandleFailedMeOplog(oplog *pkgservice.BaseOplog) (err error)
func (*ProtocolManager) HandleFailedValidMeOplog ¶
func (pm *ProtocolManager) HandleFailedValidMeOplog(oplog *pkgservice.BaseOplog, processInfo pkgservice.ProcessInfo) (err error)
func (*ProtocolManager) HandleForceSyncMeOplog ¶
func (pm *ProtocolManager) HandleForceSyncMeOplog(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleForceSyncMeOplogAck ¶
func (pm *ProtocolManager) HandleForceSyncMeOplogAck(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleForceSyncMeOplogByMerkle ¶
func (pm *ProtocolManager) HandleForceSyncMeOplogByMerkle(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleForceSyncMeOplogByMerkleAck ¶
func (pm *ProtocolManager) HandleForceSyncMeOplogByMerkleAck(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleForceSyncMeOplogByOplogAck ¶
func (pm *ProtocolManager) HandleForceSyncMeOplogByOplogAck(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleInitMeInfo ¶
func (pm *ProtocolManager) HandleInitMeInfo(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleInitMeInfoAck ¶
func (pm *ProtocolManager) HandleInitMeInfoAck(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleInitMeInfoSync ¶
func (pm *ProtocolManager) HandleInitMeInfoSync(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleInternalSyncBoard ¶
func (pm *ProtocolManager) HandleInternalSyncBoard( dataBytes []byte, peer *pkgservice.PttPeer, ) error
func (*ProtocolManager) HandleInternalSyncBoardAck ¶
func (pm *ProtocolManager) HandleInternalSyncBoardAck( dataBytes []byte, peer *pkgservice.PttPeer, ) error
func (*ProtocolManager) HandleInternalSyncFriend ¶
func (pm *ProtocolManager) HandleInternalSyncFriend( dataBytes []byte, peer *pkgservice.PttPeer, ) error
func (*ProtocolManager) HandleInternalSyncFriendAck ¶
func (pm *ProtocolManager) HandleInternalSyncFriendAck( dataBytes []byte, peer *pkgservice.PttPeer, ) error
func (*ProtocolManager) HandleMeOplogs ¶
func (pm *ProtocolManager) HandleMeOplogs(oplogs []*pkgservice.BaseOplog, peer *pkgservice.PttPeer, isUpdateSyncTime bool) error
func (*ProtocolManager) HandleMessage ¶
func (pm *ProtocolManager) HandleMessage(op pkgservice.OpType, dataBytes []byte, peer *pkgservice.PttPeer) (err error)
func (*ProtocolManager) HandleNonRegisteredMessage ¶
func (pm *ProtocolManager) HandleNonRegisteredMessage(op pkgservice.OpType, dataBytes []byte, peer *pkgservice.PttPeer) (err error)
func (*ProtocolManager) HandlePendingMeOplogs ¶
func (pm *ProtocolManager) HandlePendingMeOplogs(oplogs []*pkgservice.BaseOplog, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleRevokeMyNode ¶
func (pm *ProtocolManager) HandleRevokeMyNode(oplog *MasterOplog, isLockedEntity bool, isLockedNode bool) error
func (*ProtocolManager) HandleRevokeOtherNode ¶
func (pm *ProtocolManager) HandleRevokeOtherNode(oplog *MasterOplog, node *MyNode, fromID *types.PttID) error
func (*ProtocolManager) HandleSendRaftMsgs ¶
func (pm *ProtocolManager) HandleSendRaftMsgs(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleSyncMeOplog ¶
func (pm *ProtocolManager) HandleSyncMeOplog(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleSyncMeOplogAck ¶
func (pm *ProtocolManager) HandleSyncMeOplogAck(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleSyncMeOplogInvalid ¶
func (pm *ProtocolManager) HandleSyncMeOplogInvalid(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleSyncNewMeOplog ¶
func (pm *ProtocolManager) HandleSyncNewMeOplog(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleSyncNewMeOplogAck ¶
func (pm *ProtocolManager) HandleSyncNewMeOplogAck(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleSyncPendingMeOplog ¶
func (pm *ProtocolManager) HandleSyncPendingMeOplog(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) HandleSyncPendingMeOplogAck ¶
func (pm *ProtocolManager) HandleSyncPendingMeOplogAck(dataBytes []byte, peer *pkgservice.PttPeer) error
func (*ProtocolManager) InitMeInfo ¶
func (pm *ProtocolManager) InitMeInfo(peer *pkgservice.PttPeer) error
func (*ProtocolManager) InitMeInfoAck ¶
func (pm *ProtocolManager) InitMeInfoAck(data *InitMeInfo, peer *pkgservice.PttPeer) error
func (*ProtocolManager) InitMeInfoLoop ¶
func (pm *ProtocolManager) InitMeInfoLoop()
func (*ProtocolManager) InitMeInfoSync ¶
func (pm *ProtocolManager) InitMeInfoSync(peer *pkgservice.PttPeer) error
func (*ProtocolManager) InternalSignMyOplog ¶
func (pm *ProtocolManager) InternalSignMyOplog(oplog *pkgservice.BaseOplog) (bool, error)
func (*ProtocolManager) InternalSyncBoard ¶
func (pm *ProtocolManager) InternalSyncBoard( oplog *pkgservice.BaseOplog, peer *pkgservice.PttPeer, ) error
func (*ProtocolManager) InternalSyncFriend ¶
func (pm *ProtocolManager) InternalSyncFriend( oplog *pkgservice.BaseOplog, peer *pkgservice.PttPeer, ) error
func (*ProtocolManager) InternalSyncToAlive ¶
func (pm *ProtocolManager) InternalSyncToAlive(oplog *MasterOplog, weight uint32) error
func (*ProtocolManager) IsImportantPeer ¶
func (pm *ProtocolManager) IsImportantPeer(peer *pkgservice.PttPeer) bool
func (*ProtocolManager) IsJoinBoardRequests ¶
func (pm *ProtocolManager) IsJoinBoardRequests(hash *common.Address) bool
func (*ProtocolManager) IsJoinFriendKeyHash ¶
func (pm *ProtocolManager) IsJoinFriendKeyHash(hash *common.Address) bool
func (*ProtocolManager) IsJoinFriendRequests ¶
func (pm *ProtocolManager) IsJoinFriendRequests(hash *common.Address) bool
func (*ProtocolManager) IsJoinMeKeyHash ¶
func (pm *ProtocolManager) IsJoinMeKeyHash(hash *common.Address) bool
func (*ProtocolManager) IsJoinMeRequests ¶
func (pm *ProtocolManager) IsJoinMeRequests(hash *common.Address) bool
func (*ProtocolManager) IsMaster ¶
func (pm *ProtocolManager) IsMaster(id *types.PttID, isLocked bool) bool
func (*ProtocolManager) IsMember ¶
func (pm *ProtocolManager) IsMember(id *types.PttID, isLocked bool) bool
func (*ProtocolManager) IsMemberPeer ¶
func (pm *ProtocolManager) IsMemberPeer(peer *pkgservice.PttPeer) bool
func (*ProtocolManager) IsMyDevice ¶
func (pm *ProtocolManager) IsMyDevice(peer *pkgservice.PttPeer) bool
func (*ProtocolManager) IsPendingPeer ¶
func (pm *ProtocolManager) IsPendingPeer(peer *pkgservice.PttPeer) bool
func (*ProtocolManager) IsValidInternalOplog ¶
func (pm *ProtocolManager) IsValidInternalOplog(signInfos []*pkgservice.SignInfo) (*types.PttID, uint32, bool)
func (*ProtocolManager) IsValidMyOplog ¶
func (pm *ProtocolManager) IsValidMyOplog(signInfos []*pkgservice.SignInfo) (*types.PttID, uint32, bool)
func (*ProtocolManager) JoinBoard ¶
func (pm *ProtocolManager) JoinBoard(joinRequest *pkgservice.JoinRequest) error
func (*ProtocolManager) JoinBoardLoop ¶
func (pm *ProtocolManager) JoinBoardLoop()
func (*ProtocolManager) JoinFriend ¶
func (pm *ProtocolManager) JoinFriend(joinRequest *pkgservice.JoinRequest) error
func (*ProtocolManager) JoinFriendKeyList ¶
func (pm *ProtocolManager) JoinFriendKeyList() []*pkgservice.KeyInfo
func (*ProtocolManager) JoinFriendLoop ¶
func (pm *ProtocolManager) JoinFriendLoop() error
func (*ProtocolManager) JoinMe ¶
func (pm *ProtocolManager) JoinMe(joinRequest *pkgservice.JoinRequest, myKeyBytes []byte) error
func (*ProtocolManager) JoinMeLoop ¶
func (pm *ProtocolManager) JoinMeLoop() error
func (*ProtocolManager) LoadMyNodes ¶
func (pm *ProtocolManager) LoadMyNodes() error
func (*ProtocolManager) LoadPeers ¶
func (pm *ProtocolManager) LoadPeers() error
func (*ProtocolManager) LoadRaftAppliedIndex ¶
func (pm *ProtocolManager) LoadRaftAppliedIndex(isLocked bool) error
func (*ProtocolManager) LoadRaftConfState ¶
func (pm *ProtocolManager) LoadRaftConfState(isLocked bool) error
func (*ProtocolManager) LoadRaftLastIndex ¶
func (pm *ProtocolManager) LoadRaftLastIndex(isLocked bool) error
func (*ProtocolManager) LoadRaftSnapshotIndex ¶
func (pm *ProtocolManager) LoadRaftSnapshotIndex(isLocked bool) error
func (*ProtocolManager) LockMyNodes ¶
func (pm *ProtocolManager) LockMyNodes()
func (*ProtocolManager) MarshalRaftAppliedIndexKey ¶
func (pm *ProtocolManager) MarshalRaftAppliedIndexKey() ([]byte, error)
func (*ProtocolManager) MarshalRaftConfStateKey ¶
func (pm *ProtocolManager) MarshalRaftConfStateKey() ([]byte, error)
func (*ProtocolManager) MarshalRaftLastIndexKey ¶
func (pm *ProtocolManager) MarshalRaftLastIndexKey() ([]byte, error)
func (*ProtocolManager) MarshalRaftSnapshotIndexKey ¶
func (pm *ProtocolManager) MarshalRaftSnapshotIndexKey() ([]byte, error)
func (*ProtocolManager) Master0Hash ¶
func (pm *ProtocolManager) Master0Hash() []byte
func (*ProtocolManager) MaybeTriggerRaftSnapshot ¶
func (pm *ProtocolManager) MaybeTriggerRaftSnapshot() error
func (*ProtocolManager) MigrateMe ¶
func (pm *ProtocolManager) MigrateMe(newMyInfo *MyInfo) error
func (*ProtocolManager) NewMeOplog ¶
func (pm *ProtocolManager) NewMeOplog(objID *types.PttID, op pkgservice.OpType, opData pkgservice.OpData) (pkgservice.Oplog, error)
func (*ProtocolManager) ProposeRaftAddNode ¶
func (pm *ProtocolManager) ProposeRaftAddNode(nodeID *discover.NodeID, weight uint32) error
func (*ProtocolManager) ProposeRaftRemoveNode ¶
func (pm *ProtocolManager) ProposeRaftRemoveNode(nodeID *discover.NodeID) error
func (*ProtocolManager) ProposeRaftRequestLead ¶
func (pm *ProtocolManager) ProposeRaftRequestLead() error
func (*ProtocolManager) PublishRaftEntries ¶
func (pm *ProtocolManager) PublishRaftEntries(ents []pb.Entry) error
func (*ProtocolManager) PublishRaftSnapshot ¶
func (pm *ProtocolManager) PublishRaftSnapshot(snap pb.Snapshot) error
func (*ProtocolManager) Quorum ¶
func (pm *ProtocolManager) Quorum() uint32
func (*ProtocolManager) RLockMyNodes ¶
func (pm *ProtocolManager) RLockMyNodes()
func (*ProtocolManager) RUnlockMyNodes ¶
func (pm *ProtocolManager) RUnlockMyNodes()
func (*ProtocolManager) RegisterPeer ¶
func (pm *ProtocolManager) RegisterPeer(peer *pkgservice.PttPeer, peerType pkgservice.PeerType, isLocked bool) error
func (*ProtocolManager) RegisterPendingPeer ¶
func (pm *ProtocolManager) RegisterPendingPeer(peer *pkgservice.PttPeer, isLocked bool) error
func (*ProtocolManager) RemoveBoardRequests ¶
func (pm *ProtocolManager) RemoveBoardRequests(hash []byte) (bool, error)
func (*ProtocolManager) RemoveFriendRequests ¶
func (pm *ProtocolManager) RemoveFriendRequests(hash []byte) (bool, error)
func (*ProtocolManager) RemoveMeRequests ¶
func (pm *ProtocolManager) RemoveMeRequests(hash []byte) (bool, error)
func (*ProtocolManager) RevokeNode ¶
func (pm *ProtocolManager) RevokeNode(nodeID *discover.NodeID) error
RevokeNode intends to revoke a specific node
func (*ProtocolManager) SendRaftMsgs ¶
func (pm *ProtocolManager) SendRaftMsgs(msgs []pb.Message) error
func (*ProtocolManager) ServeRaftChannels ¶
func (pm *ProtocolManager) ServeRaftChannels() error
func (*ProtocolManager) ServeRaftProposal ¶
func (pm *ProtocolManager) ServeRaftProposal()
func (*ProtocolManager) SetMasterDB ¶
func (pm *ProtocolManager) SetMasterDB(oplog *pkgservice.BaseOplog)
func (*ProtocolManager) SetMeDB ¶
func (pm *ProtocolManager) SetMeDB(oplog *pkgservice.BaseOplog)
func (*ProtocolManager) SetMeOplogIsSync ¶
func (pm *ProtocolManager) SetMeOplogIsSync(oplog *MeOplog, isBroadcast bool) (bool, error)
func (*ProtocolManager) SetNewestEntityLog ¶
func (pm *ProtocolManager) SetNewestEntityLog( oplog *pkgservice.BaseOplog, spm pkgservice.ServiceProtocolManager, ) (types.Bool, error)
func (*ProtocolManager) SetNewestMeOplog ¶
func (pm *ProtocolManager) SetNewestMeOplog(oplog *pkgservice.BaseOplog) (err error)
func (*ProtocolManager) SetRaftAppliedIndex ¶
func (pm *ProtocolManager) SetRaftAppliedIndex(idx uint64, isLocked bool) error
raft-applied-index
func (*ProtocolManager) SetRaftConfState ¶
func (pm *ProtocolManager) SetRaftConfState(cs pb.ConfState, isLocked bool) error
func (*ProtocolManager) SetRaftLastIndex ¶
func (pm *ProtocolManager) SetRaftLastIndex(idx uint64, isLocked bool) error
func (*ProtocolManager) SetRaftLead ¶
func (pm *ProtocolManager) SetRaftLead(idx uint64, isLocked bool) error
func (*ProtocolManager) SetRaftSnapshotIndex ¶
func (pm *ProtocolManager) SetRaftSnapshotIndex(idx uint64, isLocked bool) error
func (*ProtocolManager) Start ¶
func (pm *ProtocolManager) Start() error
func (*ProtocolManager) StartRaft ¶
func (pm *ProtocolManager) StartRaft(peers []raft.Peer, isNew bool) error
func (*ProtocolManager) Stop ¶
func (pm *ProtocolManager) Stop() error
func (*ProtocolManager) StopRaft ¶
func (pm *ProtocolManager) StopRaft() error
func (*ProtocolManager) Sync ¶
func (pm *ProtocolManager) Sync(peer *pkgservice.PttPeer) error
func (*ProtocolManager) SyncJoinBoard ¶
func (pm *ProtocolManager) SyncJoinBoard() error
func (*ProtocolManager) SyncJoinBoardLoop ¶
func (pm *ProtocolManager) SyncJoinBoardLoop() error
func (*ProtocolManager) SyncJoinFriend ¶
func (pm *ProtocolManager) SyncJoinFriend() error
func (*ProtocolManager) SyncJoinFriendLoop ¶
func (pm *ProtocolManager) SyncJoinFriendLoop() error
func (*ProtocolManager) SyncJoinMe ¶
func (pm *ProtocolManager) SyncJoinMe() error
func (*ProtocolManager) SyncJoinMeLoop ¶
func (pm *ProtocolManager) SyncJoinMeLoop() error
func (*ProtocolManager) SyncPendingMeOplog ¶
func (pm *ProtocolManager) SyncPendingMeOplog(peer *pkgservice.PttPeer) error
func (*ProtocolManager) UnlockMyNodes ¶
func (pm *ProtocolManager) UnlockMyNodes()
func (*ProtocolManager) ValidateIntegrateSignMyOplog ¶
func (pm *ProtocolManager) ValidateIntegrateSignMyOplog(oplog *pkgservice.BaseOplog, isLocked bool) (err error)
type PublicAPI ¶
type PublicAPI struct {
// contains filtered or unexported fields
}
func NewPublicAPI ¶
func (*PublicAPI) Get ¶
func (api *PublicAPI) Get() (*BackendMyInfo, error)
func (*PublicAPI) GetMeList ¶
func (api *PublicAPI) GetMeList() ([]*BackendMyInfo, error)
func (*PublicAPI) ShowURL ¶
func (api *PublicAPI) ShowURL() (*pkgservice.BackendJoinURL, error)
type RaftStatus ¶
type RaftStorage ¶
type RaftStorage struct {
// contains filtered or unexported fields
}
func NewRaftStorage ¶
func NewRaftStorage(isClean bool, myID *types.PttID) (*RaftStorage, error)
func NewRaftStorageWithClean ¶
func NewRaftStorageWithClean(myID *types.PttID) (*RaftStorage, error)
func (*RaftStorage) ApplySnapshot ¶
func (rs *RaftStorage) ApplySnapshot(snap pb.Snapshot) error
func (*RaftStorage) CreateSnapshot ¶
func (*RaftStorage) FirstIndex ¶
func (rs *RaftStorage) FirstIndex() (uint64, error)
func (*RaftStorage) GetIdxByKey ¶
func (rs *RaftStorage) GetIdxByKey(key []byte) (uint64, error)
func (*RaftStorage) GetPrevIter ¶
func (rs *RaftStorage) GetPrevIter(idx uint64) (iterator.Iterator, error)
func (*RaftStorage) GetTermByIdx ¶
func (rs *RaftStorage) GetTermByIdx(idx uint64) (uint64, error)
func (*RaftStorage) InitialState ¶
func (*RaftStorage) LastIndex ¶
func (rs *RaftStorage) LastIndex() (uint64, error)
func (*RaftStorage) LoadHardState ¶
func (rs *RaftStorage) LoadHardState() (pb.HardState, error)
func (*RaftStorage) LoadSnapshot ¶
func (rs *RaftStorage) LoadSnapshot() (pb.Snapshot, error)
func (*RaftStorage) Lock ¶
func (rs *RaftStorage) Lock()
func (*RaftStorage) MarshalKey ¶
func (rs *RaftStorage) MarshalKey(idx uint64) ([]byte, error)
func (*RaftStorage) MarshalKeyRaftHardState ¶
func (rs *RaftStorage) MarshalKeyRaftHardState() ([]byte, error)
func (*RaftStorage) MarshalKeyRaftSnapshot ¶
func (rs *RaftStorage) MarshalKeyRaftSnapshot() ([]byte, error)
func (*RaftStorage) SetHardState ¶
func (rs *RaftStorage) SetHardState(st pb.HardState) error
func (*RaftStorage) Unlock ¶
func (rs *RaftStorage) Unlock()
type RequestRaftLead ¶
type RequestRaftLead struct{}
type SendRaftMsgs ¶
type ServiceProtocolManager ¶
type ServiceProtocolManager struct { *pkgservice.BaseServiceProtocolManager MyID *types.PttID MyInfo *MyInfo // contains filtered or unexported fields }
func NewServiceProtocolManager ¶
func NewServiceProtocolManager(myID *types.PttID, ptt pkgservice.MyPtt, service pkgservice.Service, contentBackend *content.Backend) (*ServiceProtocolManager, error)
func (*ServiceProtocolManager) CreateMe ¶
func (spm *ServiceProtocolManager) CreateMe(myID *types.PttID, myKey *ecdsa.PrivateKey, contentBackend *content.Backend) error
func (*ServiceProtocolManager) NewEmptyEntity ¶
func (spm *ServiceProtocolManager) NewEmptyEntity() pkgservice.Entity
Source Files ¶
- api.go
- backend.go
- backend_core.go
- backend_types.go
- config.go
- errors.go
- globals.go
- master_oplog.go
- master_oplog_types.go
- me_oplog.go
- me_oplog_types.go
- my_info.go
- my_info_utils_key_info.go
- my_node.go
- protocol_approve_join.go
- protocol_approve_join_board.go
- protocol_approve_join_friend.go
- protocol_approve_join_me.go
- protocol_board_logs.go
- protocol_create_entity_oplog.go
- protocol_create_join_entity_oplog.go
- protocol_create_me.go
- protocol_create_my_board.go
- protocol_create_my_profile.go
- protocol_delete_me.go
- protocol_delete_me_logs.go
- protocol_entity_logs.go
- protocol_friend_logs.go
- protocol_get_master_oplog_list.go
- protocol_get_me_list.go
- protocol_get_me_oplog_list.go
- protocol_get_me_oplog_merkle_node_list.go
- protocol_get_raft_status.go
- protocol_handle_me_oplog.go
- protocol_handle_me_oplogs.go
- protocol_init_me_info.go
- protocol_init_me_info_ack.go
- protocol_init_me_info_sync.go
- protocol_internal_sync_board.go
- protocol_internal_sync_friend.go
- protocol_internal_sync_to_alive.go
- protocol_join_board.go
- protocol_join_board_logs.go
- protocol_join_friend.go
- protocol_join_friend_logs.go
- protocol_join_me.go
- protocol_manager.go
- protocol_manager_utils.go
- protocol_manager_utils_handle_message.go
- protocol_manager_utils_join.go
- protocol_manager_utils_join_board.go
- protocol_manager_utils_join_friend.go
- protocol_manager_utils_join_me.go
- protocol_manager_utils_master.go
- protocol_manager_utils_me_oplog.go
- protocol_manager_utils_member.go
- protocol_manager_utils_my_node.go
- protocol_manager_utils_oplog.go
- protocol_manager_utils_peer.go
- protocol_master_oplog.go
- protocol_me_oplog.go
- protocol_migrate_me.go
- protocol_migrate_me_logs.go
- protocol_raft.go
- protocol_raft_entries.go
- protocol_raft_snapshot.go
- protocol_request_raft_lead.go
- protocol_revoke_node.go
- protocol_send_raft_msgs.go
- protocol_sync_me_oplog.go
- raft_storage.go
- service_protocol_manager.go
- types.go
- utils.go
Click to show internal directories.
Click to hide internal directories.