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

Fix/list map assets #123

Merged
merged 2 commits into from
Apr 3, 2019
Merged

Fix/list map assets #123

merged 2 commits into from
Apr 3, 2019

Conversation

DavidMarchant
Copy link
Contributor

@DavidMarchant DavidMarchant commented Mar 27, 2019

Fixes #122

Changes to the --map option of show data.

No longer show data when a single asset is returned
Demand each word be the name of an asset
Allow assets to end with -bmc
Remove splitting on =

CHANGE TO REQUIREMENTS
Now have all assets' names that occur anywhere as substrings be returned
This should hopefully only run at around 5n operations, where n is the number of assets in the system
Thinking about it this is fully incorrect as checking a length m string includes a substring takes m operations so this is around nm +4n operations or O(nm)

It is also worth noting here how this solution deals with the edge case in which there are asset names that are substrings of other asset names in the system. In the case that the longer asset is specified in the map, they're both returned.

Timing looks like so

[root@localhost flight-inventory]# time bin/inventory show data new_node -m 6 
smol001                                                                       
new_switch                                                                    
new_new                                                                       
new                                                                           
                                                                              
real    0m0.376s                                                              
user    0m0.286s                                                              
sys     0m0.088s 

where no command is:

  NAME:                                                         
                                                                
    inventory                                                   
                                                                
  DESCRIPTION:                                                  
                                                                
    Parser of hardware information into unified formats.        
                                                                
  COMMANDS:                                                     
                                                                
    create        Create a new asset                            
    delete        Delete the stored data for one or more assets 
    edit          Edit stored data for an asset                 
    help          Display global or [command] help documentation
    list          List all assets that have stored data         
    modify        Change mutable asset data                     
    parse         Parse and store inventory information         
    show          View data                                     
                                                                
  GLOBAL OPTIONS:                                               
                                                                
    -h, --help                                                  
        Display help documentation                              
                                                                
    --version                                                   
        Display version information                             
                                                                
                                                                
real    0m0.367s                                                
user    0m0.318s                                                
sys     0m0.047s                                                

@DavidMarchant DavidMarchant merged commit ad87b30 into develop Apr 3, 2019
@DavidMarchant DavidMarchant deleted the fix/list-map-assets branch April 3, 2019 13:35
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.

1 participant