github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/event/remote.go (about)

     1  package event
     2  
     3  import (
     4  	"github.com/qri-io/dag"
     5  	"github.com/qri-io/qri/dsref"
     6  )
     7  
     8  const (
     9  	// ETRemoteClientPushVersionProgress indicates a change in progress of a
    10  	// dataset version push. Progress can fire as much as once-per-block.
    11  	// subscriptions do not block the publisher
    12  	// payload will be a RemoteEvent
    13  	ETRemoteClientPushVersionProgress = Type("remoteClient:PushVersionProgress")
    14  	// ETRemoteClientPushVersionCompleted indicates a version successfully pushed
    15  	// to a remote.
    16  	// payload will be a RemoteEvent
    17  	ETRemoteClientPushVersionCompleted = Type("remoteClient:PushVersionCompleted")
    18  	// ETRemoteClientPushDatasetCompleted indicates pushing a dataset
    19  	// (logbook + versions) completed
    20  	// payload will be a RemoteEvent
    21  	ETRemoteClientPushDatasetCompleted = Type("remoteClient:PushDatasetCompleted")
    22  	// ETDatasetPushed fires at the same logical time as
    23  	// ETRemoteClientPushDatasetCompleted, but contains a versionInfo payload
    24  	// for subscribers that need additional fields from the pushed dataset
    25  	// payload will be a dsref.VersionInfo
    26  	ETDatasetPushed = Type("remoteClient:DatasetPushed")
    27  	// ETRemoteClientPullVersionProgress indicates a change in progress of a
    28  	// dataset version pull. Progress can fire as much as once-per-block.
    29  	// subscriptions do not block the publisher
    30  	// payload will be a RemoteEvent
    31  	ETRemoteClientPullVersionProgress = Type("remoteClient:PullVersionProgress")
    32  	// ETRemoteClientPullVersionCompleted indicates a version successfully pulled
    33  	// from a remote.
    34  	// payload will be a RemoteEvent
    35  	ETRemoteClientPullVersionCompleted = Type("remoteClient:PullVersionCompleted")
    36  	// ETRemoteClientPullDatasetCompleted indicates pulling a dataset
    37  	// (logbook + versions) completed
    38  	// payload will be a RemoteEvent
    39  	ETRemoteClientPullDatasetCompleted = Type("remoteClient:PullDatasetCompleted")
    40  	// ETDatasetPulled fires at the same logical time as
    41  	// ETRemoteClientPullDatasetCompleted, but contains a versionInfo payload
    42  	// for subscribers that need additional fields from the pulled dataset
    43  	// payload will be a dsref.VersionInfo
    44  	ETDatasetPulled = Type("remoteClient:DatasetPulled")
    45  	// ETRemoteClientRemoveDatasetCompleted indicates removing a dataset
    46  	// (logbook + versions) remove completed
    47  	// payload will be a RemoteEvent
    48  	ETRemoteClientRemoveDatasetCompleted = Type("remoteClient:RemoveDatasetCompleted")
    49  	// ETRemoteDatasetFollowed indicates that the dataset has been followed by a user
    50  	// payload is an `InitID` string
    51  	ETRemoteDatasetFollowed = Type("remote:DatasetFollowed")
    52  	// ETRemoteDatasetUnfollowed indicates that the dataset has been unfollowed by a user
    53  	// payload is an `InitID` string
    54  	ETRemoteDatasetUnfollowed = Type("remote:DatasetUnfollowed")
    55  	// ETRemoteDatasetIssueOpened indicates that an issue has been opened for this dataset
    56  	// payload is an `initID` string
    57  	ETRemoteDatasetIssueOpened = Type("remote:DatasetIssueOpened")
    58  	// ETRemoteDatasetIssueClosed indicates that an issue has been closed for this dataset
    59  	// payload is an `initID` string
    60  	ETRemoteDatasetIssueClosed = Type("remote:DatasetIssueClosed")
    61  )
    62  
    63  // RemoteEvent encapsulates the push / pull progress of a dataset version
    64  type RemoteEvent struct {
    65  	Ref        dsref.Ref      `json:"ref"`
    66  	RemoteAddr string         `json:"remoteAddr"`
    67  	Progress   dag.Completion `json:"progress"`
    68  	Error      error          `json:"error,omitempty"`
    69  }
    70  
    71  const (
    72  	// ETRegistryProfileCreated indicates a successful profile creation on the
    73  	// configured registry
    74  	// payload will be a RegistryProfileCreated
    75  	ETRegistryProfileCreated = Type("registry:ProfileCreated")
    76  )
    77  
    78  // RegistryProfileCreated encapsulates fields in a profile creation response
    79  // from the configured registry
    80  type RegistryProfileCreated struct {
    81  	RegistryLocation string `json:"registryLocation"`
    82  	ProfileID        string `json:"profileID"`
    83  	Username         string `json:"username"`
    84  }