Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

[Network Config Mgr] Add cache basic entities #584

Merged
merged 2 commits into from
Apr 12, 2021

Conversation

xieus
Copy link
Contributor

@xieus xieus commented Apr 5, 2021

This PR adds the basic cache/db entity classes.

  • HostResourceIdCache
  • HostResourceStateCache
  • VpcResourceCache
  • NodeInfoCache (updated)

Two internal classes

  • ResourceMeta
  • VpcResourceMeta

@xieus xieus added the feature feature development label Apr 5, 2021
@xieus xieus added this to the Version 0.12.2021.04.30 milestone Apr 5, 2021
@xieus xieus requested a review from pkommoju April 5, 2021 16:47
@xieus xieus self-assigned this Apr 5, 2021
@xieus xieus requested a review from cj-chung April 5, 2021 16:53
Comment on lines +10 to +11
// Private IP => List<ResourceMetadata>
private HashMap<String, List<ResourceMeta>> resourceMetas;
Copy link
Contributor

Choose a reason for hiding this comment

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

@xieus What's the IP here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is the private ip within the VPC ip space.

Comment on lines 10 to 12
private String ownerId;
private List<Goalstate.ResourceIdType> resources;

Copy link
Contributor

Choose a reason for hiding this comment

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

@xieus What's the ownerId here? projectID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It depends. It can be private ip or host id, depending on the scenario.

Comment on lines +15 to +16
// Map <VNI, Map<PIP, List<ResoruceIDType>>
private ICache<String, VpcResourceMeta> vpcResourceMetas;
Copy link
Contributor

Choose a reason for hiding this comment

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

@xieus Is the PIP equals to Host IP?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PIP == Private IP.

Comment on lines 12 to 14
public class HostResourceStateCache {
// Map <ResourceId, ResourceState>
private ICache<String, Object> hostResourceStates;
Copy link
Contributor

Choose a reason for hiding this comment

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

@xieus Is HostResourceStatesCache better?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it correct to state that HostResourceStateCache entires are connected to HostResourceIdCache through the key (ResourceId) of HostResourceStateCache? Without this clarification, it is possible to assume that since HostResourceIdCache has hostid as the key, HostResourceStateCache may also have the same key.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@xieus Is HostResourceStatesCache better?

Hmm, we can justify either of them :-) For class name, I prefer singular. What do you think of?

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer singular in most cases and this is one of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it correct to state that HostResourceStateCache entires are connected to HostResourceIdCache through the key (ResourceId) of HostResourceStateCache?

You are right.

Without this clarification, it is possible to assume that since HostResourceIdCache has hostid as the key, HostResourceStateCache may also have the same key.

Hmm, good point. I think we should rename HostResourceStateCache to ResourceStateCache to avoid confusion.

Copy link
Contributor

Choose a reason for hiding this comment

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

ResourceStateCache fits better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

Comment on lines 13 to 15
public class HostResourceIdCache {
// Map <HostId, List<ResoruceIDType>>
private ICache<String, ResourceMeta> hostResourceMetas;
Copy link
Contributor

Choose a reason for hiding this comment

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

@xieus Is HostResourceIdsCache better?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think HostResourceIdCache is fine becuase cache of something is more common than cahce of somethings.

pkommoju added a commit to pkommoju/alcor that referenced this pull request Apr 8, 2021
API to Register, Unregister, Query NCM partitions.
This API is subject to change depending on PR futurewei-cloud#584.
The API itself will be in the next PR but this one adds the necessary
infrastrure.
@xieus xieus merged commit e93f14d into futurewei-cloud:master Apr 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature feature development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants