Documentation
¶
Index ¶
- Variables
- type Oracle
- type Server
- func (s *Server) AssignIds(ctx context.Context, num *pb.Num) (*pb.AssignedIds, error)
- func (s *Server) CommitOrAbort(ctx context.Context, src *api.TxnContext) (*api.TxnContext, error)
- func (s *Server) Connect(ctx context.Context, m *pb.Member) (resp *pb.ConnectionState, err error)
- func (s *Server) DeleteNamespace(ctx context.Context, in *pb.DeleteNsRequest) (*pb.Status, error)
- func (s *Server) Inform(ctx context.Context, req *pb.TabletRequest) (*pb.TabletResponse, error)
- func (s *Server) Init()
- func (s *Server) KnownGroups() []uint32
- func (s *Server) Leader(gid uint32) *conn.Pool
- func (s *Server) MarshalMembershipState() ([]byte, error)
- func (s *Server) MoveTablet(ctx context.Context, req *pb.MoveTabletRequest) (*pb.Status, error)
- func (s *Server) Oracle(_ *api.Payload, server pb.Zero_OracleServer) error
- func (s *Server) RemoveNode(ctx context.Context, req *pb.RemoveNodeRequest) (*pb.Status, error)
- func (s *Server) ServingTablet(tablet string) *pb.Tablet
- func (s *Server) SetMembershipState(state *pb.MembershipState)
- func (s *Server) ShouldServe(ctx context.Context, tablet *pb.Tablet) (resp *pb.Tablet, err error)
- func (s *Server) StreamMembership(_ *api.Payload, stream pb.Zero_StreamMembershipServer) error
- func (s *Server) Timestamps(ctx context.Context, num *pb.Num) (*pb.AssignedIds, error)
- func (s *Server) TryAbort(ctx context.Context, txns *pb.TxnTimestamps) (*pb.OracleDelta, error)
- func (s *Server) UpdateMembership(ctx context.Context, group *pb.Group) (*api.Payload, error)
Constants ¶
This section is empty.
Variables ¶
var Zero x.SubCommand
Zero is the sub-command used to start Zero servers.
Functions ¶
This section is empty.
Types ¶
type Oracle ¶
Oracle stores and manages the transaction state and conflict detection.
func (*Oracle) MaxPending ¶
MaxPending returns the maximum assigned timestamp.
type Server ¶
type Server struct {
x.SafeMutex
Node *node
NumReplicas int
// embedding the pb.UnimplementedZeroServer struct to ensure forward compatibility of the server.
pb.UnimplementedZeroServer
// contains filtered or unexported fields
}
Server implements the zero server.
func (*Server) AssignIds ¶
AssignIds is used to assign new ids (UIDs, NsIDs) by communicating with the leader of the RAFT group responsible for handing out ids. If bump is set to true in the request then the lease for the given id type is bumped to num.Val and {startId, endId} of the newly leased ids in the process of bump is returned.
func (*Server) CommitOrAbort ¶
func (s *Server) CommitOrAbort(ctx context.Context, src *api.TxnContext) (*api.TxnContext, error)
CommitOrAbort either commits a transaction or aborts it. The abortion can happen under the following conditions 1) the api.TxnContext.Aborted flag is set in the src argument 2) if there's an error (e.g server is not the leader or there's a conflicting transaction)
func (*Server) Connect ¶
Connect is used by Alpha nodes to connect the very first time with group zero.
func (*Server) DeleteNamespace ¶
DeleteNamespace removes the tablets for deleted namespace from the membership state.
func (*Server) Inform ¶
func (s *Server) Inform(ctx context.Context, req *pb.TabletRequest) (*pb.TabletResponse, error)
func (*Server) KnownGroups ¶
KnownGroups returns a list of the known groups.
func (*Server) MarshalMembershipState ¶
MarshalMembershipState returns the marshaled membership state.
func (*Server) MoveTablet ¶
MoveTablet can be used to move a tablet to a specific group. It takes in tablet and destination group as argument. It returns a *pb.Status to be used by the `/moveTablet` HTTP handler in Zero.
func (*Server) Oracle ¶
Oracle streams the oracle state to the alphas. The first entry sent by Zero contains the entire state of transactions. Zero periodically confirms receipt from the group, and truncates its state. This 2-way acknowledgement is a safe way to get the status of all the transactions.
func (*Server) RemoveNode ¶
RemoveNode removes the given node from the given group. It's the user's responsibility to ensure that node doesn't come back again before calling the api.
func (*Server) ServingTablet ¶
ServingTablet returns the Tablet called tablet.
func (*Server) SetMembershipState ¶
func (s *Server) SetMembershipState(state *pb.MembershipState)
SetMembershipState updates the membership state to the given one.
func (*Server) ShouldServe ¶
ShouldServe returns the tablet serving the predicate passed in the request.
func (*Server) StreamMembership ¶
StreamMembership periodically streams the membership state to the given stream.
func (*Server) Timestamps ¶
Timestamps is used to assign startTs for a new transaction
func (*Server) TryAbort ¶
func (s *Server) TryAbort(ctx context.Context, txns *pb.TxnTimestamps) (*pb.OracleDelta, error)
TryAbort attempts to abort the given transactions which are not already committed..