func FindClientAndDocument(
	ctx context.Context,
	be *backend.Backend,
	clientID []byte,
	pack *change.Pack,
	createDocIfNotExist bool,
) (*db.ClientInfo, *db.DocInfo, error) {
	clientInfo, err := be.DB.FindClientInfoByID(ctx, db.IDFromBytes(clientID))
	if err != nil {
		return nil, nil, err
	}
	docInfo, err := be.DB.FindDocInfoByKey(
		ctx,
		clientInfo,
		pack.DocumentKey.BSONKey(),
		createDocIfNotExist,
	)
	if err != nil {
		return nil, nil, err
	}
	return clientInfo, docInfo, nil
}
FindClientAndDocument finds the client and the document.
package clients
import (
	"context"
	"errors"
	"github.com/yorkie-team/yorkie/pkg/document/change"
	"github.com/yorkie-team/yorkie/yorkie/backend"
	"github.com/yorkie-team/yorkie/yorkie/backend/db"
)
var (
	ErrInvalidClientKey = errors.New("invalid client key")
	ErrInvalidClientID = errors.New("invalid client id")
)
func Activate(
	ctx context.Context,
	be *backend.Backend,
	clientKey string,
) (*db.ClientInfo, error) {
	return be.DB.ActivateClient(ctx, clientKey)
}
func Deactivate(
	ctx context.Context,
	be *backend.Backend,
	clientID []byte,
) (*db.ClientInfo, error) {
	return be.DB.DeactivateClient(ctx, db.IDFromBytes(clientID))
}