Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cms backend #776

Merged
merged 7 commits into from
Mar 1, 2019
Merged

Feature/cms backend #776

merged 7 commits into from
Mar 1, 2019

Conversation

udeeshagautam
Copy link
Contributor

Cms SQL Tools Service first set of Apis

  • Connect to CMS Server
  • Add/Remove Registered Servers to CMS
  • Add remove Server Groups to CMS


public async Task HandleCreateCentralManagementServerRequest(CreateCentralManagementServerParams createCmsParams, RequestContext<ListRegisteredServersResult> requestContext)
{
Logger.Write(TraceEventType.Verbose, "HandleCreateCentralManagementServerRequest");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed none of the handlers are async. If there are any long running operations we should make sure they are async so we don't block the ipc handler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure will do for new connections. I noticed we do async notification for new connection but not for list databases like scenarios - so will follow the same.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't recommend following the connection service example. The notification system it uses is outdated and complicated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coveralls
Copy link

coveralls commented Feb 22, 2019

Coverage Status

Coverage increased (+0.05%) to 73.674% when pulling 26ce53c on feature/cms-backend into 0222828 on master.

{
public string RegisteredServerName { get; set; }

public string RegisterdServerDescription { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small typo: RegisteredServerDescription

ServerConnection conn = await ValidateAndCreateConnection(createCmsParams.ConnectParams);

// Get Current Reg Servers on CMS
RegisteredServersStore store = new RegisteredServersStore(conn);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Using the alias/display name passed for CMS

Copy link
Member

@kburtram kburtram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at my feedback. I think a few of the naming recommendations should be taken prior to merging, other comments are for you consideration.

namespace Microsoft.SqlTools.ServiceLayer.Cms
{
/// <summary>
/// Main class for DacFx service
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DacFx should be CmsService


// Get Current Reg Servers on CMS
RegisteredServersStore store = new RegisteredServersStore(conn);
ServerGroup parentGroup = store.DatabaseEngineServerGroup; //TODO Do we need other types like Integrated Service and Analysis Service
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're not supporting SSIS or AS in this codebase, so probably don't need the TODO. If we want that in the future there will need to be large scale refactoring in a bunch of places.

}
catch (Exception e)
{
// Exception related to run tak will be captured here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: typo tak -> task

/// <summary>
/// Internal variable for testability
/// </summary>
internal Task CmsTask { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are you using this property for? I don't see it being accessed outside this class, and then only to assign to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only used in tests. Since the call to Handle functions in Service is async, we need a way to wait for task to complete to validate requestContext result. This was one pattern used for testing across multiple services so used the same.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense. For some reason when I search for usages yesterday I didn't see any, but now I see this being used through out the tests. Maybe I had a typo in search box 😄

{
if (registerdServerStore == null)
{
registerdServerStore = RegisteredServersStore.LocalFileStore;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should you assign using the setter (i.e. this.ServerStore = …) to go through the lock, or take the lock explicitly here?

}

/// <summary>
/// Parmaters to Add Registered Server to top level CMS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Parmaters -> Parameters

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..note this same typo appears to have been copy\pasted a few times


public string RegisteredServerDescription { get; set; }

public ConnectionDetails RegServerConnectionDetails { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should be consistent whether to use RegisteredServer or RegServer, personally I would always use RegisteredServer event though it's too verbose.

RequestType<CreateCentralManagementServerParams, ListRegisteredServersResult>.Create("cms/createCms");
}

public class ListRegisteredServerRequest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be ListRegisteredServersRequest (plural)?

public class ListRegisteredServerRequest
{
public static readonly RequestType<ListRegisteredServerParams, ListRegisteredServersResult> Type =
RequestType<ListRegisteredServerParams, ListRegisteredServersResult>.Create("cms/listRegServers");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd write out RegisteredServers completely in the JSON-RPC method names.


public string RelativePath { get; set; }

public ConnectionDetails connectionDetails { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connectionDetails should be ConnectionDetails

@udeeshagautam udeeshagautam merged commit 9551022 into master Mar 1, 2019
@udeeshagautam udeeshagautam deleted the feature/cms-backend branch March 1, 2019 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants