Documentation ¶
Overview ¶
Package web defines web APIs to be used with Spanner migration tool frontend. Apart from schema conversion, this package involves API to update converted schema.
Index ¶
- func GetConv(w http.ResponseWriter, r *http.Request)
- func GetSessions(w http.ResponseWriter, r *http.Request)
- func IsOfflineSession(w http.ResponseWriter, r *http.Request)
- func NewLocalSessionStore() *localStore
- func ReadSessionFileForSessionMetadata(metadata *SessionMetadata, sessionJSON string) error
- func ResumeSession(w http.ResponseWriter, r *http.Request)
- func SaveRemoteSession(w http.ResponseWriter, r *http.Request)
- func SetSessionStorageConnectionState(migrationProjectId string, spProjectId string, spInstanceId string) (bool, bool)
- func UpdateSessionFile() error
- type ConvWithMetadata
- type Counter
- type SchemaConversionSession
- type SessionMetadata
- type SessionNameError
- type SessionParams
- type SessionService
- type SessionState
- type SessionStore
- type SourceDBConnDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSessions ¶
func GetSessions(w http.ResponseWriter, r *http.Request)
func IsOfflineSession ¶
func IsOfflineSession(w http.ResponseWriter, r *http.Request)
func NewLocalSessionStore ¶
func NewLocalSessionStore() *localStore
func ReadSessionFileForSessionMetadata ¶
func ReadSessionFileForSessionMetadata(metadata *SessionMetadata, sessionJSON string) error
func ResumeSession ¶
func ResumeSession(w http.ResponseWriter, r *http.Request)
func SaveRemoteSession ¶
func SaveRemoteSession(w http.ResponseWriter, r *http.Request)
func UpdateSessionFile ¶
func UpdateSessionFile() error
UpdateSessionFile updates the content of session file with latest sessionState.Conv while also dumping schemas and report.
Types ¶
type ConvWithMetadata ¶
type ConvWithMetadata struct { SessionMetadata internal.Conv }
type Counter ¶
type Counter struct {
ObjectId string
}
Counter used to generate id for table, column, Foreignkey and indexes.
type SchemaConversionSession ¶
type SessionMetadata ¶
type SessionNameError ¶
func (*SessionNameError) Error ¶
func (e *SessionNameError) Error() string
type SessionParams ¶
type SessionParams struct { Driver string `json:"driver"` FilePath string `json:"filePath"` DBName string `json:"dbName"` CreatedAt string `json:"createdAt"` }
session contains the metadata for a session file. A session file is a snapshot of an ongoing Spanner migration tool conversion session, and consists of an internal.Conv struct in JSON format.
type SessionService ¶
type SessionService struct {
// contains filtered or unexported fields
}
func NewSessionService ¶
func NewSessionService(ctx context.Context, store SessionStore) *SessionService
func (*SessionService) GetConvWithMetadata ¶
func (ss *SessionService) GetConvWithMetadata(versionId string) (ConvWithMetadata, error)
func (*SessionService) GetSessionsMetadata ¶
func (ss *SessionService) GetSessionsMetadata() ([]SchemaConversionSession, error)
func (*SessionService) SaveSession ¶
func (ss *SessionService) SaveSession(scs SchemaConversionSession) error
type SessionState ¶
type SessionState struct { SourceDB *sql.DB // Connection to source database in case of direct connection SourceDBConnDetails SourceDBConnDetails // Connection details for source database DbName string // Name of source database Driver string // Name of Spanner migration tool driver in use Conv *internal.Conv // Current conversion state SessionFile string // Path to session file IsOffline bool // True if the connection to remote metadata database is invalid GCPProjectID string // GCP project id where the migration resources are created SpannerProjectId string // Project id of the spanner instance SpannerInstanceID string Dialect string IsSharded bool TmpDir string ShardedDbConnDetails []profiles.DirectConnectionConfig SourceProfileConfig profiles.SourceProfileConfig Region string SpannerDatabaseName string Bucket string RootPath string SessionMetadata SessionMetadata Error error Counter }
SessionState stores information for the current migration session.
func GetSessionState ¶
func GetSessionState() *SessionState
type SessionStore ¶
type SessionStore interface { GetSessionsMetadata(ctx context.Context) ([]SchemaConversionSession, error) GetConvWithMetadata(ctx context.Context, versionId string) (ConvWithMetadata, error) SaveSession(ctx context.Context, scs SchemaConversionSession) error IsSessionNameUnique(ctx context.Context, scs SchemaConversionSession) (bool, error) }
func NewRemoteSessionStore ¶
func NewRemoteSessionStore(spannerClient *spanner.Client) SessionStore
Click to show internal directories.
Click to hide internal directories.