-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add solr client. Signed-off-by: pritamdas99 <[email protected]>
- Loading branch information
1 parent
0123160
commit 495ccff
Showing
36 changed files
with
1,448 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ package mssql | |
|
||
import ( | ||
"context" | ||
|
||
"fmt" | ||
|
||
_ "github.com/microsoft/go-mssqldb" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ package pgpool | |
|
||
import ( | ||
"context" | ||
|
||
"fmt" | ||
|
||
olddbapi "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ package rabbitmq | |
import ( | ||
"context" | ||
"errors" | ||
|
||
"fmt" | ||
"strings" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package solr | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/go-logr/logr" | ||
"github.com/go-resty/resty/v2" | ||
) | ||
|
||
const ( | ||
writeCollectionName = "kubedb-system" | ||
Action = "action" | ||
ActionBackup = "BACKUP" | ||
ActionRestore = "RESTORE" | ||
ActionCreate = "CREATE" | ||
ActionDeleteBackup = "DELETEBACKUP" | ||
Name = "name" | ||
Location = "location" | ||
Repository = "repository" | ||
Collection = "collection" | ||
Async = "async" | ||
PurgeUnused = "purgeUnused" | ||
BackupId = "backupId" | ||
DeleteStatus = "DELETESTATUS" | ||
RequestStatus = "REQUESTSTATUS" | ||
RequestId = "requestid" | ||
NumShards = "numShards" | ||
ReplicationFactor = "replicationFactor" | ||
) | ||
|
||
type SLClient interface { | ||
GetClusterStatus() (*Response, error) | ||
ListCollection() (*Response, error) | ||
CreateCollection() (*Response, error) | ||
WriteCollection() (*Response, error) | ||
ReadCollection() (*Response, error) | ||
BackupCollection(ctx context.Context, collection string, backupName string, location string, repository string) (*Response, error) | ||
RestoreCollection(ctx context.Context, collection string, backupName string, location string, repository string, backupId int) (*Response, error) | ||
FlushStatus(asyncId string) (*Response, error) | ||
RequestStatus(asyncId string) (*Response, error) | ||
DeleteBackup(ctx context.Context, backupName string, collection string, location string, repository string, backupId int, snap string) (*Response, error) | ||
PurgeBackup(ctx context.Context, backupName string, collection string, location string, repository string, snap string) (*Response, error) | ||
GetConfig() *Config | ||
GetClient() *resty.Client | ||
GetLog() logr.Logger | ||
DecodeBackupResponse(data map[string]interface{}, collection string) ([]byte, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package solr | ||
|
||
import ( | ||
"context" | ||
"io" | ||
"net/http" | ||
|
||
"github.com/go-logr/logr" | ||
api "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
type Client struct { | ||
SLClient | ||
} | ||
|
||
type ClientOptions struct { | ||
KBClient client.Client | ||
DB *api.Solr | ||
Ctx context.Context | ||
Log logr.Logger | ||
} | ||
|
||
type Config struct { | ||
host string | ||
connectionScheme string | ||
transport *http.Transport | ||
log logr.Logger | ||
} | ||
|
||
type Response struct { | ||
Code int | ||
header http.Header | ||
body io.ReadCloser | ||
} | ||
|
||
type Doc struct { | ||
Id int `json:"id,omitempty" yaml:"id,omitempty"` | ||
DB string `json:"db,omitempty" yaml:"db,omitempty"` | ||
} | ||
|
||
type Data struct { | ||
CommitWithin int `json:"commitWithin,omitempty" yaml:"commitWithin,omitempty"` | ||
Overwrite bool `json:"overwrite,omitempty" yaml:"overwrite,omitempty"` | ||
Doc *Doc `json:"doc,omitempty" yaml:"doc,omitempty"` | ||
} | ||
|
||
type ADD struct { | ||
Add *Data `json:"add,omitempty" yaml:"add,omitempty"` | ||
} | ||
|
||
type QueryParams struct { | ||
Query string `json:"query,omitempty" yaml:"query,omitempty"` | ||
Limit int `json:"limit,omitempty" yaml:"limit,omitempty"` | ||
} | ||
|
||
type CreateParams struct { | ||
Name string `json:"name,omitempty" yaml:"name,omitempty"` | ||
Config string `json:"config,omitempty" yaml:"config,omitempty"` | ||
NumShards int `json:"numShards,omitempty" yaml:"numShards,omitempty"` | ||
ReplicationFactor int `json:"replicationFactor,omitempty" yaml:"replicationFactor,omitempty"` | ||
} |
Oops, something went wrong.